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 is shown below.
SELECT IF V1 = 1.
SPSS Select If - Real World 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
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 IFwith TEMPORARY.
- If you'd like to analyze two (or more) groups of cases separately, use SPLIT FILE instead of
- Note that you can't undo
SELECT IFif 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
OR. For example,
SELECT IF V1 = 1 OR V2 = 1deletes all cases who don't have
- 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).