| Date: | Tue, 13 May 2008 14:40:43 -0400 |
| Reply-To: | Richard Ristow <wrristow@mindspring.com> |
| Sender: | "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU> |
|
| From: | Richard Ristow <wrristow@mindspring.com> |
| Subject: | Re: missing values in do if |
|
|
| Content-Type: | text/plain; charset="us-ascii"; format=flowed |
|---|
I wrote too quickly. What I wrote was right, but not enough. At 01:19
PM5/12/2008, Keval Khichadia wrote:
>[In the following syntax] I get the correct value (1) for LowIncome
>but there are several cases when there are values for num_in_family
>and Fisap_Income where the value should be 0 but I am getting $sysmis
The code I sent,
...
else if SYSMIS(num_in_family) | SYSMIS(Fisap_Income).
compute LowIncome = $sysmis.
else.
compute LowIncome = 0.
end if.
won't be reached if either variable is missing, because the first test,
>do if num_in_family = 1 & Fisap_Income <= 19600.
will return 'missing' in that case, and the rest of the DO IF will be skipped.
You need something like this, checking for missing values at the
*beginning* of the DO IF:
MISSING VALUES LowIncome(9).
DO IF SYSMIS(num_in_family) | SYSMIS(Fisap_Income).
. compute LowIncome = 9.
else if num_in_family = 2 & Fisap_Income <= 26400.
. compute LowIncome = 1.
...
else.
. compute LowIncome = 0.
end if.
Note that 9 is defined as a user-missing value for "LowIncome", and
that, not SYSMIS, is the value it's given if you have missing data.
Art Kendall's right about this one.
=====================
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
|