Recode missing values with Syntax
Today, Aleksandar sent us the following question:
“I’m having problems to recode system missing values to 0 with syntax
editor. How can I do that?”
In SPSS Syntax, missing values can be addressed via the keywords “sysmis” or “missing”. For this explanation we assume that in addition to the values 1 and 2, there are also values 3 and 4 which are defined as missing values. Please find some syntax below and an explanation of what they do. var2 stands for the variable name we are recoding.
RECODE var2 (missing = 3).
All missing values (i.e., values 3 and 4 and perhaps also system missing values) will have the value 3. 3 will still be defined as missing.
RECODE var2 (missing = 15).
All missing values (i.e., values 3 and 4 and perhaps also system missing values) will have the value 15. 15 will not be defined as missing.
If you have system missing values and want to recode only these to another value, you can use the keyword “sysmis” instead of “missing”.
RECODE var2 (sysmis = 6).
Again, if you have defined values 3 and 4 as missing, 6 will not be recognized as a (formerly) missing value. You may wish to either define 6 now as missing or to assign a value label that tells you the meaning of 6.