Date: Tue, 27 Apr 2004 08:25:15 -0500
Reply-To: "Peck, Jon" <peck@spss.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Peck, Jon" <peck@spss.com>
Subject: Re: 0/missing = 0
Content-Type: text/plain; charset="us-ascii"
You can write this type of expression a little more directly and transparently with a style like this. The first term gives the normal result, and the second converts it to sysmis when the defined conditions occur.
compute newvar = vara/(varb+varc) + $sysmis*missing(varb+varc).
Sample results:
vara varb varc newvar
1.00 2.00 3.00 .20
1.00 . . .
.00 . . .
.00 1.00 2.00 .00
. . . .
1.00 .00 .00 .
. .00 .00 .
Regards,
Jon Peck
-----Original Message-----
From: Sally Zitzer [mailto:sallyz@u.washington.edu]
Sent: Monday, April 26, 2004 5:11 PM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: [SPSSX-L] 0/missing = 0
Hi,
It turns out that 0/missing = 0 by definition. (also 0*missing = 0, this
is shown in the syntax manual)
I have a user who wants 0/missing = missing. I'm wondering if anyone
knows of better way than the following --
His sample equation is --
compute newvar = (vara/(varb+varc)).
execute.
If varb or varc are missing, and vara = 0, he wants newvar = missing
But SPSS sets newvar = 0
What works for this specific example is --
compute newvar = (vara/(varb+varc)).
if (missing(varb+varc) and vara=0) newvar = $sysmis.
execute.
newvar is first computed to be 0, but then recomputed to be missing
For more complicated equations it could get really messy.
Thanks,
Sally in Seattle
Sally Zitzer, C&C, Senior Computing Specialist, Statistical Software
sallyz@cac.washington.edu or sallyz@u.washington.edu (206)-543-8515