Unit 7 · Prepare your data
How to use Select Cases and Split File in SPSS
Analyse a subset of participants with Select Cases, compare groups with Split File, and switch filters off again.
Quick answer: How do you use Select Cases and Split File in SPSS?
- Click Data › Select Cases.
- Choose If condition is satisfied, click If… and type a rule such as gender = 2.
- Choose Filter out unselected cases and click OK.
- When finished, go back and choose All cases.
Working with subsets of your data
Select Cases runs analyses on only some participants, such as only women or only people who passed an attention check. Split File runs every analysis separately for each group.
When to use it
- Excluding participants who failed inclusion criteria.
- Analysing one group on its own.
- Producing the same descriptives for each group quickly (Split File).
How it works
Filtering hides unselected cases without deleting them: SPSS creates a filter variable, crosses out row numbers and shows Filter On. Conditions use = and ~= (not equal), & (and) and | (or). Split File stays on until you turn it off, and both settings affect every analysis you run while they’re active.
Worked example
Select Cases with check = 1 & age >= 18 keeps adults who passed the attention check; everyone else is filtered out but still in the file.
Key terms
- Filter
- Temporarily hides cases from analysis.
- Split File
- Repeats analyses for each level of a grouping variable.
Common mistakes
- Forgetting to switch a filter or split off, so later analyses use the wrong cases.
- Choosing Delete unselected cases and saving over the original file.
How to do it in SPSS
The SPSS syntax
Prefer typing to clicking? Open File › New › Syntax, paste this in, select it and choose Run › Selection. Every dialog's Paste button writes the same kind of code.
* Keep only women (gender = 2), without deleting anyone.
USE ALL.
COMPUTE filter_$ = (gender = 2).
FILTER BY filter_$.
EXECUTE.
* Switch the filter off again.
FILTER OFF.
USE ALL.
EXECUTE.
* Repeat analyses for each gender, then switch it off.
SORT CASES BY gender.
SPLIT FILE LAYERED BY gender.
DESCRIPTIVES VARIABLES=score.
SPLIT FILE OFF.Practice data
Download the file used in this lesson and run it yourself in SPSS: you should get the same results as the screens above.
- students.savStudent survey: gender, age, course, exam score and attention check (N = 100)
Now practise it interactively →
Reading is only half of it. Tap through the real SPSS menus, read the output and pick the right write-up in 7 quick questions, with instant feedback on every answer.
Practice for this lesson is part of Pro, with every unit, unlimited hearts and saved progress.