Date: Thu, 16 Jun 2011 09:35:09 -0400
Reply-To: Gene Maguin <emaguin@buffalo.edu>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Gene Maguin <emaguin@buffalo.edu>
Subject: Re: recode using multiple variables
In-Reply-To: <1308224744941-4494728.post@n5.nabble.com>
Content-Type: text/plain; charset="us-ascii"
Pancho,
It sounds like you want to determine how many cases have a value of 1 for
any of the variables M, H, F, or G. Some of the cases may have a value 1 for
just one of the four variables; other cases may have a 1 for two of the
variables; and other cases may have a value of one for all of the four
variables. If that is all you want to know, the solution is very simple.
First, look at the documentation for the Count command.
The actual syntax is
Count ones=M H F G(1).
Gene Maguin
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of
pmulonge
Sent: Thursday, June 16, 2011 7:46 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Re: recode using multiple variables
Hello all, I hope you can really help me with this seemingly simple thing,
for I am at my wits end.
So I have four variables and I would like to add up all the cases that have
value 1 for these variables. So did the following:
RECODE M (1=1) (ELSE=SYSMIS) INTO ATL1.
RECODE H (1=2) (ELSE=SYSMIS) INTO ATL1.
RECODE F (1=3) (ELSE=SYSMIS) INTO ATL1.
RECODE G (1=4) (ELSE=SYSMIS) INTO ATL1.
Now when I run
FREQ M H F G ATL1.
There is deeply disturbing outcome: The values 1 thru 4 in ATL1 do NOT add
up to the sum M=1, H=1, F=1, G=1.
In fact, I noticed that in ATL1 the number of cases for value 1 is less than
the number of cases for M=1 (in the M freq table). This is also true for
ATL1 values 2, 3, 4, they are just less than value 1 for H F and G
respectively.
In essence, I just am loosing data when I try and sum the cases. Can anyone
explain this to me or find an alternative syntax?
I tried the syntax below, which gives the exact same disturbing result when
I run the FREQs.
COMPUTE NEW_VAR=ATL1D.
IF (M=1) ATL1D=1.
IF (H=1) ATL1D=1.
IF (F=1) ATL1D=1.
IF (G=1) ATL1D=1.
FREQ ATL1D.
P.S. Why am I doing all of this, well in the end I would like to find the
union of the non-disjoint sets M H F G in my data and I have not been
successfull thus far.
-----
Pancho Mulongeni,
Research Assistant
Pharmaccess Foundation,
Namibia
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/recode-using-multiple-variable
s-tp1079099p4494728.html
Sent from the SPSSX Discussion mailing list archive at Nabble.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
=====================
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