FAQ/cc - CBU statistics Wiki
location: FAQ / cc

Identifying complete cases in SPSS and R

Identifies complete cases using variables A and B. You will need to insert a comma separated list of your variable names in place of a,b in the NMISS statement. Incomplete cases are filtered out of all succeeding analyses. To enable deletion of incomplete cases the file is also sorted so that the complete cases are at the top of the file.

DEFINE MISS (!POS !CMDEND).
COMPUTE NM=NMISS(!1). 
EXE. 
COMPUTE NMC=0. 
IF (NM EQ 0) NMC=1. 
FILTER BY NMC. 
SORT CASES BY NMC (D). 
EXE. 
!ENDDEFINE.

This can then be run using a comma separated list of variable names.

MISS A,B.
EXE.

To use all cases in the file:

FILTER OFF.

In R the function na.omit extracts complete cases from the data frame. In the example below the data.frame, cc, contains complete cases.

x <- read.spss("raw65n.sav")
x1 <- data.frame(x)
cc <- na.omit(x1)

None: FAQ/cc (last edited 2013-03-08 10:17:15 by localhost)