LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2008)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 13 May 2008 12:05:52 -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
Comments: To: Keval Khichadia <kkhichadia@yahoo.com>
Comments: cc: Melissa Ives <mives@chestnut.org>
In-Reply-To:  <156336.37718.qm@web45807.mail.sp1.yahoo.com>
Content-Type: text/plain; charset="us-ascii"; format=flowed

At 01:19 PM 5/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 > >do if num_in_family = 1 & Fisap_Income <= 19600. >compute LowIncome = 1. >else if num_in_family = 2 & Fisap_Income <= 26400. >compute LowIncome = 1. >else if num_in_family = 3 & Fisap_Income <= 33200 . >compute LowIncome = 1. >else if num_in_family = 4 & Fisap_Income <= 40000. >compute LowIncome = 1. >else if num_in_family = 5 & Fisap_Income <= 46800. >compute LowIncome = 1. >else if num_in_family = 6 & Fisap_Income <= 53600. >compute LowIncome = 1. >else if num_in_family = 7 & Fisap_Income <= 60400. >compute LowIncome = 1. >else if num_in_family = 8 & Fisap_Income <= 67200. >compute LowIncome = 1. >else if num_in_family = $sysmis | Fisap_Income = $sysmis. >compute LowIncome = $sysmis. >else. >compute LowIncome = 0. >end if.

Your problem is that the final COMPUTE, >compute LowIncome = 0. will never be executed.

The value in test >else if num_in_family = $sysmis | Fisap_Income = $sysmis. is never 'true', and it's never 'false', either; it's 'missing'. In a DO IF, if any test returns 'missing', its clause *and all following clauses* are skipped, with no notification. (Distinguishing between 'false' and 'missing' in tests was one of SPSS's good ideas; treating 'missing' this way in DO IF, and just like 'false' everywhere else, was one of the bad ones.)

"SYSMIS" is not a value, so nothing can be equal to it.

You want,

else if SYSMIS(num_in_family) | SYSMIS(Fisap_Income). compute LowIncome = $sysmis. else. compute LowIncome = 0. end if.

===================== 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


Back to: Top of message | Previous page | Main SPSSX-L page