For the first, depends on what you want to do with the NAs. The simplest would be to set 0 to missing for all variables. Then you will get a missing if all variables have missing (given that you use OR) which is more or less what you would want.
For the second.
Firts, you don't need the
If VESTTATRECODE is not assigned anything during the subsequent commands, it will remain sysmis anyway. (also, the EXECUTE is redundant - you only need an EXECUTE after all the transformation commands.
Given execution order, it is actually line 5 and 6 that does most of the work.
I would guess you could do something like (not tested):
Code: Select all
DO IF any(EMPSTATD,13,14,15).
compute VETSTATRECODE= (VET01LTR = 2 OR VET90X01 = 2 OR VET75X90= 2 OR VETVIETN= 2 OR VET55X64= 2 OR VETKOREA= 2 OR VET47X50= 2 OR VETWWII = 2 OR VETOTHER = 2) AND AGE > 16.
* Check if my interpretation of the parentheses is right!.