Reputation: 155
I want to compute multiple new variables for cases that are NOT missing multiple values. For those cases where Var.1
to Var.10
are missing, then I want the computed vars A, B, C
to be SYSMIS.
Example code:
DO IF (NOT MISSING(Var.1 to Var.10)).
COMPUTE A=0.
COMPUTE B=0.
COMPUTE C=0.
END IF.
This produces multiple errors: DO IF - The number of arguments to a function was incorrect. END IF - The command does not follow an unclosed DO IF command.
I've tried removing periods and adding/removing parentheses to no effect. Thanks for your help.
Upvotes: 2
Views: 1200
Reputation: 11350
You could first count the missing values in your multiple set:
count Nmiss=Var.1 to Var.10 (missing).
Now you can use the count in your if
statement:
do if Nmiss=0.
...
(or do if Nmiss<10.
- depending on your exact goal)
Upvotes: 2