|Date: ||Thu, 1 May 2003 17:01:56 -0400|
|Reply-To: ||Richard Ristow <email@example.com>|
|Sender: ||"SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>|
|From: ||Richard Ristow <firstname.lastname@example.org>|
|Subject: ||Re: Recoding missing values|
|Content-Type: ||text/plain; charset="us-ascii"; format=flowed|
At 09:01 AM 5/1/2003 -0400, Nancy Crowell wrote:
>I have a variable with missing values that I want to set as equal to
>another variable (that has the correct values). [...] I've tried the
>DO IF (cesdtot2=$sysmis).
>I don't get any error messages, but nothing happens.
and, at 01:19 PM 5/1/2003 -0400, wrote:
>Eddy Oppordoes solved my problem:
>IF (MISSING(cesdtot2)) cesdtot2=dcesdtot.
>It worked like a charm.
Exactly. But this is an example of how tricky SPSS's test logic can be.
It's a carefully done but subtle decision, to distinguish MISSING test
results from NEGATIVE test results.
The test "(cesdtot2=$sysmis)" cannot return TRUE or FALSE, ever. It's
comparing something to a 'missing' quantity ($sysmis), and even if the
value of cesdtot2 is system-missing, SPSS doesn't consider them equal,
but indeterminable: two different, unknown quantities.
That, of course, is why the test functions MISSING() and SYSMIS() are
provided. Also, you can use VALUE(), which returns the variable's value
as a valid quantity, if it is user-missing (but not if it is system-missing).
But the logic *is* tricky to remember; it's not intuitive that
system-missing is not equal to itself! To make this harder (and SPSS
may have been wrong, here),
If *any* test in a DO IF/ELSE IF chain returns MISSING, that and all
subsequent clauses are skipped *WITH NO MESSAGE*. Useful alternatives would be
. At least an option to give an error message when a test evaluates to
. A "MISSING" statement, analogous to "ELSE", that in a DO IF construct
would evaluate 'true' if a previous test evaluated 'missing'.
In the meantime, it is wise start most DO IF constructs with tests for
MISSING() or SYSMIS() that ensure subsequent clauses see only valid data.