In SPSS, SELECT IF deletes cases (rows of data) that don’t satisfy some condition(s). Like so, SELECT IF basically means “don’t delete if …” A minimal example isSELECT IF(GENDER = 1).
SPSS SELECT IF – Some Examples
Say we collected data on our employees and the resulting data file is employees.sav. Our client is only interested in female respondents so we decide to delete all male respondents and those with missing values on gender. The syntax below demonstrates how to do so by using SELECT IF.
SPSS SELECT IF Syntax
select if gender ne 0.
- If you’re not sure whether you’d like to use cases at a later stage or not, use FILTER instead of SELECT IF. Like so you can exclude cases from analysis without removing them from the data.
- Another alternative for excluding cases temporarily is combining SELECT IF with TEMPORARY.
- If you’d like to analyze two (or more) groups of cases separately, use SPLIT FILE instead of SELECT IF.
- Note that you can’t undo SELECT IF if you delete the “wrong” cases. This is usually no big issue if you carefully work from syntax. (In this case, just rerun your syntax up to the point where you went wrong.)
- You can combine more than one condition with AND and/or OR. For example, SELECT IF V1 = 1 OR V2 = 1 deletes all cases who don’t have 1 on V1 or V2.
- You can use functions within conditions. For example, SELECT IF NMISS(ALL) = 0. deletes all cases with one or more missing values (over all variables in the data).