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.

Free tutorialPro practiceAbout 5 minutes7 practice questions

Quick answer: How do you use Select Cases and Split File in SPSS?

  1. Click Data › Select Cases.
  2. Choose If condition is satisfied, click If… and type a rule such as gender = 2.
  3. Choose Filter out unselected cases and click OK.
  4. When finished, go back and choose All cases.

Last updated November 2026 · Not sure this is the right test? Try the Which statistical test? tool.

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

Select Cases

Data › Select Cases runs your analyses on just some participants, such as only women or only people who passed an attention check.

Select Cases
Variables
Gender [gender]
Age in years [age]
Attention check [check]
Select1
All cases
✓If condition is satisfied
gender = 22
Random sample of cases
Based on time or case range
Output3
✓Filter out unselected cases
Copy selected cases to a new dataset
Delete unselected cases
Current Status: Filter cases by values of filter_$4
OKPasteResetCancelHelp
  1. 1
    SelectChoose If condition is satisfied, then click If… to write the rule.
  2. 2
    The conditiongender = 2 keeps only people coded 2 (Female). Use ~= for “not equal”, & for “and”, | for “or”.
  3. 3
    OutputFilter out unselected cases hides people without deleting them. Avoid Delete unless you’ve saved a copy.
  4. 4
    Filter is onSPSS adds a filter_$ variable, crosses out unselected row numbers and shows Filter On at the bottom of the window.

Filters stay on until you switch them off. When you’re done, go back to Select Cases and choose All cases, or every later analysis will still use the subset.

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.

More in Prepare your data