SPSS Macros for replacing missing data

SPSS macro

SPSS Macros for replacing missing data

A lot of online vendor tools provide a data value on a multi-select question however they leave the value missing if the respondent didn’t select it. Most of the analysis I want to do needs to have a zero (or some other value) present in order to calculate the statistics correctly.

I wrote a few SPSS Macros that make it very easy to replace the missing values on your data.  Here are the two macros

 
*///////////////.
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.

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.