SPSS command: SPSS SAMPLE
Draw a random sample of cases
Sample Cases selects a random subset of rows, either keeping each case with a given probability or taking exactly n cases from the first N.
Free · No account · Files stay on your device · Updated 18 October 2026
What it tells you
Crosstabs follows the SPSS SAMPLE algorithm with a visible seed, so the same seed always returns the same rows, and the sample downloads as a CSV.
- Which cases were selected and how many, with the seed that produced them.
- For the proportion method, how close the realized sample size came to the target; the count varies from draw to draw.
- A reproducible record of the draw: anyone with the same file, settings and seed gets the same rows back in Crosstabs.
When to use it
Use it when
- A holdout or validation subset for checking a model built on the rest.
- A random subsample for manual review, coding open ends or quality checks.
- Cutting a very large file down to a quick working sample.
Use something else when
- Stratified, cluster or PPS sampling for a survey design: use Complex Sample Selection.
- Weighted selection: SAMPLE ignores case weights, so every row has the same chance.
How to run it in Crosstabs
- 01
Open your data
Open a .sav, CSV or Excel file in the workspace and switch to Statistics mode. For exact sampling, rows are counted in their current order.
- 02
Choose Sample Cases
In the Utilities and charts group pick Sample Cases.
- 03
Choose the sample type
Sample: Approximately a proportion of cases, with Proportion (0–1); or Exactly n cases from the first N, with n cases and from the first N cases.
- 04
Set the seed and draw
Enter a Random seed (record it for reproducibility), press Draw sample, then Download sample (CSV).
Worked example
Computed by the Crosstabs engine from the synthetic data below when this page was built — not typed in.
Data
A file of 40 cases (only the case count matters: SAMPLE ignores the values and the case weights). Three draws use seed 20261017.
| Sample | Cases selected | Selected case numbers |
|---|---|---|
| Exactly 8 cases from the first 40 | 8 | 4, 5, 7, 17, 20, 24, 26, 30 |
| Exactly 5 cases from the first 20 | 5 | 4, 5, 7, 17, 19 |
| Approximately 25% of cases | 13 | 4, 5, 7, 8, 17, 20, 24, 26, 30, 33, 35, 37, 38 |
How to read it
The exact draws return precisely 8 and 5 cases, and the second never goes past case 20. The proportion draw keeps each case independently with probability 0.25, so it returned 13 cases rather than exactly 10. Re-running with the same seed gives the same case numbers.
Output tables explained
- Sample Cases
- A summary of how many of the total cases were selected and with which seed.
- Download sample (CSV)
- The selected rows with all variables, ready to open in Crosstabs or elsewhere; the workspace dataset is not filtered.
Assumptions and notes
- Approximate sampling keeps each case independently when its uniform draw is below the proportion, so the sample size is random.
- Exact sampling walks through the first N cases and keeps each with probability (cases still needed) ÷ (cases left), which gives exactly n.
- The seeded stream reproduces the same sample here; SPSS's random stream differs, so the selected rows will not match SPSS.
How the results are validated
SAMPLE has no external fixture; its tests check the algorithm's properties. Exact sampling returns exactly n cases, never selects beyond the first N and repeats for a seed. Over 2,000 seeds, each of 20 cases is chosen with probability within 5 standard errors of 0.25 for 5-of-20 sampling, and a 30% proportion on 100,000 cases lands within 0.006 of 0.30. Validation evidence
Questions
Why didn't I get exactly 10% of my cases?
The proportion method decides each case independently, so the count varies around 10%, as in SPSS. Use Exactly n cases from the first N if you need a fixed size.
Will I get the same sample as SPSS with the same seed?
No. The method is the same, but the random number generator differs. The same seed always reproduces the same sample in Crosstabs.
Does sampling change my workspace data?
No. The selected rows are offered as a CSV download; the dataset you are analysing is left as it is.
Are case weights used?
No. SAMPLE ignores weights; every row has the same chance of selection. For probability-proportional-to-size selection use Complex Sample Selection.
Related procedures
- Select a Complex SampleCSSELECT
- SimulationSIMPLAN / SIMRUN
- BootstrappingBOOTSTRAP
- DescriptivesDESCRIPTIVES
- Free SPSS alternative: full coverage list
Run Sample Cases on your own data
Open a .sav, CSV or Excel file. Everything runs in your browser; the file never leaves your device.
SPSS is a trademark of IBM Corp. Crosstabs is not affiliated with or endorsed by IBM.