Date: Fri, 9 Sep 2005 15:07:50 -0500
Reply-To: "Oliver, Richard" <roliver@SPSS.COM>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Oliver, Richard" <roliver@SPSS.COM>
Subject: Re: computing new var along with DO IF
Content-Type: text/plain; charset="iso-8859-1"
First of all, all cases will receive some sort of value for the new variable, although for those that meet neither of your criteria, the result will be missing.
A small test (with the Value Labels command moved outside the Do If structure, but that shouldn't matter, yields the results I would expect: Cases with any value for AccessUVA other than 2 are assigned sysmis for finother.
data list free /finalneed accessUVA.
begin data
1 1
-1 1
1 2
-1 2
end data.
Do If (finalneed gt 0 and AccessUVa=2).
Compute finother=1.
else if (finalneed le 0 and AccessUVa=2).
compute finother=2.
End if.
Value label finother 1 'Received need-based aid'
2 'Did not receive need-based aid'.
list.
***result of list command
finalneed accessUVA finother
1.00 1.00 .
-1.00 1.00 .
1.00 2.00 1.00
-1.00 2.00 2.00
***.
________________________________
From: SPSSX(r) Discussion on behalf of Amy Thelk
Sent: Fri 9/9/2005 2:13 PM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: computing new var along with DO IF
I tried to compute a new variable that separates students who got need-
based financial aid from those who didn't, while filtering out from the
new variable those students who qualified for a program
called "AccessUVa." When I use the following syntax, the AccessUVa folks
are filtered out of the first value of the new variable (finother=1) but
they are not filtered out of the second (finother =2.
Can anyone let me know how to get better results than I've gotten by using
this syntax:
Do If (finalneed gt 0 and AccessUVa=2).
Compute finother=1.
else if (finalneed le 0 and AccessUVa=2).
compute finother=2.
Value label finother 1 'Received need-based aid' 2 'Did not receive need-
based aid'.
End if.
Execute.
Thanks.