Date: Thu, 11 Sep 2008 17:57:53 +0100
Reply-To: Garry Gelade <garry@business-analytic.co.uk>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Garry Gelade <garry@business-analytic.co.uk>
Subject: Re: Syntax: when did it happend for the last time?
In-Reply-To: <848b2c410809110921h50d1ea58t511f2ec158228add@mail.gmail.com>
Content-Type: text/plain; charset="us-ascii"
Here's one way.
Suppose your variables are called v1, v2, v3, v4, v5. Then:
compute last = 0.
if (v1 =-1) last = 1.
if (v2 =-1) last = 2.
if (v3 =-1) last = 3.
if (v4 =-1) last = 4.
if (v5 =-1) last = 5.
exe.
Garry Gelade.
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of
Sungeun Chung
Sent: 11 September 2008 17:21
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Syntax: when did it happend for the last time?
Dear experts.
I have a problem in creating syntax command; please help me. I appreciate
your help.
I have a data set like this:
DATA LIST FREE/ var1 var2 var3 var4 var5.
BEGIN DATA
+1 -1 +1 +1 +1
+1 -1 -1 +1 +1
+1 -1 -1 -1 + 1
+1 +1 -1 +1 + 1
END DATA.
For all variables, +1 indicate no change, - 1 indicates change.
For each case, I want to know when "-1" (change) happend for the last time.
For example, I expect
+1 -1 +1 +1 +1 2
+1 -1 -1 +1 +1 3
+1 -1 -1 -1 + 1 4
+1 +1 -1 +1 + 1 3
in which the last variable indicate when "-1" occurred for the last time.
I want to creat a syntax file (probably using "vector and loop" command").
Can anyone help me out here?
Thank you very much for your help!
Sungeun
Sungeun Chung, Ph.D.
Assistant Professor
Department of Communication
Sallee Hall 215
1 University Circle
Western Illinois University
Macomb, IL 61455
Tel: 309-298-2219; FAX: 309-298-2369
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command SIGNOFF SPSSX-L For a list of
commands to manage subscriptions, send the command INFO REFCARD
__________ NOD32 3435 (20080911) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD