Syntax: when did it happend for the last time?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Syntax: when did it happend for the last time?

Sungeun Chung
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
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: Syntax: when did it happend for the last time?

Spousta Jan
compute change = 0.
do repe v = var1 to var5 / i = 1 to 5.
- if v = -1 change = i.
end repe.
exe.

Best regards,

Jan

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Sungeun Chung
Sent: Thursday, September 11, 2008 6:21 PM
To: [hidden email]
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 [hidden email] (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



_____________
Tato zpráva a všechny připojené soubory jsou důvěrné a určené výlučně adresátovi(-ům). Jestliže nejste oprávněným adresátem, je zakázáno jakékoliv zveřejňování, zprostředkování nebo jiné použití těchto informací. Jestliže jste tento mail dostali neoprávněně, prosím, uvědomte odesilatele a smažte zprávu i přiložené soubory. Odesilatel nezodpovídá za jakékoliv chyby nebo opomenutí způsobené tímto přenosem.

Jste si jisti, že opravdu potřebujete vytisknout tuto zprávu a/nebo její přílohy? Myslete na přírodu.


This message and any attached files are confidential and intended solely for the addressee(s). Any publication, transmission or other use of the information by a person or entity other than the intended addressee is prohibited. If you receive this in error please contact the sender and delete the message as well as all attached documents. The sender does not accept liability for any errors or omissions as a result of the transmission.

Are you sure that you really need a print version of this message and/or its attachments? Think about nature.

-.- --

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: Syntax: when did it happend for the last time?

Garry Gelade
In reply to this post by Sungeun Chung
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:[hidden email]] On Behalf Of
Sungeun Chung
Sent: 11 September 2008 17:21
To: [hidden email]
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
[hidden email] (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
[hidden email] (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