Sometimes you don’t want to analyze your whole dataset — only the responses from women, only participants over 30, or only the people who completed the survey. In SPSS, the tool for that is Select Cases, and once you know how it works, it becomes one of the most useful features in your whole workflow.
Select Cases lets you temporarily filter your data so that every analysis, chart, and table you run only uses the cases you choose. The cases you exclude are not deleted — they are simply crossed out in the Data View, and you can bring them all back with a couple of clicks.
In this tutorial, you will learn how to select cases by a condition, by a random sample, by a range, and by filtering with a variable — and how to turn the selection off again, the step most beginners forget.
What Select Cases Does (and Does Not Do)
When you apply a selection, SPSS marks the unselected cases with a diagonal line through their row numbers in the Data View. Those cases are excluded from all subsequent analyses until you turn the selection off. The data itself stays in the file.
There are two things to understand:
- Nothing is deleted. Select Cases is a filter, not a data-deletion tool. If you want to permanently remove cases, use a different approach (for example, deleting rows in the Data View or saving a filtered copy of the file).
- The selection stays active until you switch it off. If you run an analysis later and wonder why your sample size has shrunk, a forgotten selection is the most likely cause. Always check the status bar at the bottom of the SPSS window — it shows “Filter On” when a selection is active.
That is also why it is good practice to save your selection as a filter variable, as covered below.
How to Open Select Cases
The menu path is the same whichever method you use: Data > Select Cases… The dialog offers five options, walked through below.
Method 1: If Condition Is Satisfied
This is the method you will use most often. It selects cases that meet a logical condition you define — for example, all participants whose gender equals 1, or all respondents with a score above 50.
- Go to Data > Select Cases…
- Choose If condition is satisfied and click If…
- In the “Select Cases: If” dialog, build your condition using the variable list and the keypad. For example, to select only female participants (where gender is coded 1 = male, 2 = female), enter:
gender = 2 - Click Continue.
- Under Output, choose Filter out unselected cases (the default). This keeps all cases in the file but excludes the unselected ones from analyses.
- Click OK.
SPSS creates a new variable called filter_$. Cases that meet the condition get a value of 1 (Selected); the rest get 0 (Not Selected). The status bar now shows “Filter On”.
More condition examples
age >= 30— participants aged 30 or older.score > 50 & group = 1— participants in group 1 with a score above 50. Use&for AND.group = 1 | group = 2— participants in group 1 or group 2. Use|for OR.~missing(income)— participants who have a value for income (no missing data on that variable).
One common mistake is forgetting that text (string) values need quotes, for example city = "Lahore". If your condition returns zero selected cases, check your value labels and coding first.
Method 2: Random Sample of Cases
Use this when you want a random subset — for example, to split your data into a training sample and a validation sample.
- Go to Data > Select Cases…
- Choose Random sample of cases and click Sample…
- Choose either Approximately (a percentage, for example 50% of cases) or Exactly (a fixed number, for example the first 100 cases from a random sample of exactly 100).
- Click Continue, then OK.
Tip: if you need the same random sample again later, set a random seed first with Transform > Random Number Generators… and choose a fixed starting point.
Method 3: Based on Time or Case Range
This option selects a consecutive block of cases by row number — for example, cases 1 through 50.
- Go to Data > Select Cases…
- Choose Based on time or case range and click Range…
- Enter the First case and Last case numbers.
- Click Continue, then OK.
This is most useful when your data file is ordered in a meaningful way — for example, when the first 50 rows are a pilot sample, or cases are sorted by date and you want only the most recent ones.
Method 4: Use Filter Variable
If you already have a variable marking which cases to include — for example, a 0/1 variable called include — use it directly.
- Go to Data > Select Cases…
- Choose Use filter variable and move your filter variable into the box.
- Click OK.
Cases with a value of 0 or a missing value on the filter variable are excluded; all other values are included. This is handy when your inclusion rule is complex or was decided outside SPSS, for example in Excel.
Method 5: All Cases (Turning the Selection Off)
This is the option people forget.
- Go to Data > Select Cases…
- Choose All cases.
- Click OK.
The diagonal lines disappear, the status bar no longer shows “Filter On”, and all cases are back in every analysis. Do this before you run any analysis meant to use the full dataset.
What Happens to the Output: Select Cases vs Output
Under Output in the Select Cases dialog you have three choices:
- Filter out unselected cases (recommended for most work): unselected cases stay in the file but are ignored by analyses. A
filter_$variable records the selection. - Copy selected cases to a new dataset: creates a new Data Editor window containing only the selected cases — useful for a separate subgroup analysis.
- Delete unselected cases: permanently removes the unselected cases from the active dataset. Use this only when you are sure — save a copy of your file first.
For a thesis, the filter option is almost always the right choice. It keeps your original data intact and leaves a clear record of what you did.
SPSS Syntax for Select Cases
Everything above can be done with syntax, which makes your work reproducible — anyone reading it can see exactly which cases were included. Paste the examples below into a Syntax Editor window (File > New > Syntax) and run them with Run > All or Ctrl+R.
*** Condition: females only (gender coded 2). *** USE ALL. COMPUTE filter_$ = (gender = 2). VARIABLE LABELS filter_$ 'gender = 2 (FILTER)'. VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. FORMATS filter_$ (f1.0). FILTER BY filter_$. EXECUTE. *** Random 50% sample. *** USE ALL. SAMPLE 0.5. EXECUTE. *** Case range: cases 1 to 50. *** USE ALL. TEMPORARY. SELECT IF ($CASENUM <= 50). EXECUTE. *** Turn the selection off. *** USE ALL. FILTER OFF. EXECUTE.
A few notes on the syntax. USE ALL resets any previous selection, so your new filter does exactly what you expect. $CASENUM is SPSS’s case-number variable. And FILTER OFF is the syntax equivalent of choosing “All cases” in the dialog.
How to Interpret the Output
Select Cases itself produces no output table — its effect shows up in the output of the analyses you run afterwards. Check these:
- Sample size (N). In any output table, compare N with the full size of your dataset. If N is smaller, the filter is working.
- Case Processing Summary tables. In tests like Crosstabs or t-tests, this summary shows N, percent included, and percent excluded. If the excluded count is not what you expected, re-check your condition.
If your N is wrong, the most common causes are a miscoded condition (wrong value label), an AND where you meant OR, or a forgotten selection from an earlier step. Run Frequencies on filter_$ first — it will show you the problem in seconds.
Common Mistakes to Avoid
- Forgetting to turn the filter off. The single most common error. Every analysis after a selection uses the subset until you choose All Cases or run
FILTER OFF. - Using “Delete unselected cases” by accident. This is permanent unless you close without saving. Always use the filter option unless you deliberately want a smaller file.
- Filtering on a variable with missing values. A condition like
income > 50000also excludes cases with missing income, because a missing value cannot satisfy the comparison. If that matters, add an explicit check such as~missing(income) & income > 50000. - Reporting the wrong N. When you write up a subgroup analysis, always report the filtered sample size, not the size of the full dataset.
Reporting in APA Style (7th ed.)
Select Cases is a data-management step, so it is not usually reported as a result on its own. What APA style does require is transparency about your sample. In your Method section, state the selection rule and the resulting sample size. Three rules to follow:
- Always give the filtered n alongside the full N so the reader can see how many cases were excluded.
- State the exact selection rule (the variable and the value or range), not just “a subset was analyzed.”
- When you report a test on the filtered data, the degrees of freedom and the sample size in the result sentence must match the filtered n — for example, t(118) = 2.45, p = .016 — not the full-sample values.
Key Takeaways
- Select Cases (Data > Select Cases…) filters your data temporarily — unselected cases are crossed out, not deleted.
- If condition is satisfied is the most flexible method: build conditions with
=,>,<,&(AND) and|(OR). - Always use Filter out unselected cases unless you deliberately want a new dataset or to delete cases permanently.
- The
filter_$variable and the “Filter On” status bar tell you exactly which cases are included — check them before every analysis. - Turn the selection off (All cases or
FILTER OFF) before any analysis that needs the full dataset, and report the filtered n.
Frequently Asked Questions
Does Select Cases delete my data?
No. With the default “Filter out unselected cases” option, the unselected cases stay in your file and are only excluded from analyses. You can restore them instantly by choosing All Cases.
How do I know if a filter is currently active?
Look at the status bar at the bottom of the Data Editor — it shows “Filter On” when a selection is active. You can also check whether a filter_$ variable exists in the Variable View, or look for diagonal lines through row numbers in the Data View.
Can I select cases based on two conditions at once?
Yes. In the If dialog, combine conditions with & for AND and | for OR, for example gender = 2 & age >= 30 selects women aged 30 or older. Use parentheses to group conditions when you mix AND and OR.
Why does my analysis show a smaller N than my dataset?
Almost always because a filter is still active from an earlier step. Go to Data > Select Cases…, choose All cases, click OK, and re-run the analysis.
Can I save a selection and reuse it later?
Yes. The filter_$ variable is saved with your .sav file when you save it. To reuse it, go to Data > Select Cases…, choose Use filter variable, and select filter_$.
Need this done on your data? Get a free quote → /services/