Thursday 27 October 2011

Dropping missing values in SPSS

(This needs some more thought and cleaning up)

The SELECT command with the SYSMIS() function can drop all missing cases from the current SPSS data set. Consider the following:

SELECT IF NOT (SYSMIS (amount)). SAVE OUTFILE= 'newfile.sav'.


This example drops all cases whose value of the variable amount is missing, and then saves this data to an SPSS system file called newfile.sav.


If the dataset has more than one coding for missing values, as is often the case for survey data, select all of the different codings for missing values with the AND operator:

SELECT IF NOT (SYSMIS(amount1)) AND NOT (SYSMIS(amount2)). SAVE OUTFILE= 'newfile.sav'.



http://kb.iu.edu/data/afay.html

No comments: