SPSS missing values
The syntax around SPSS variables with missing values is not intuitive, confusing, and poorly documented!
I know of 3 different types of commands and knowing which one to use when is not clear. Setting SPSS missing values is a great way to simplify your analysis. It is also a user-friendly way to remove (hide) outliers. This video gives a short demo of how to use the three that I use frequently.
If you want to declare a value in a cell as missing the following syntax will give you a good start.
if Var1=1 Var1=$sysmis. exe.
If you want to remove the values that are in a variable (define them as missing) the following syntax will be what you need.
MISSING VALUES Var1 to Var10 (99).
SPSS missing values Macros
Below are two macros to help with missing data. The first one is used when you first want to see if there is a given value present in another variable before declaring it recoding the missing a zero. The second one will recode all variables with missing values a zero.
*///////////////. DEFINE !Rep_Miss (Beg !TOKENS (1) /Prez !TOKENS (1) /End !TOKENS (1)) Do if !PREZ>0. do repeat v=!BEG to !END. if missing (v) v=0. end repeat. end if. exe. !ENDDEFINE. *///////////////. !Rep_Miss Prez=presentvariable Beg=v11 End=v19. *///////////////. DEFINE !Rep_Miss2 (Beg !TOKENS (1) /End !TOKENS (1)) do repeat v=!BEG to !END. if missing (v) v=0. end repeat. exe. !ENDDEFINE. *///////////////. /*!Rep_Miss2 Beg=v11 End=v19.