SPLIT FILE is a command for having separate output for subsets of cases. It does not literally split your file into smaller files. Subsets are defined by the values on one or more split variables. After running SPLIT FILE, output is reported for each split group separately until you run SPLIT FILE OFF.
Example of output split by education_typeSPSS Split File - Basic Use
Similarly to FILTER and WEIGHT, SPLIT FILE has three main commands.
- SPLIT FILE BY [...]. switches it on or changes the variable(s) defining the groups of cases.
- SHOW SPLIT FILE. tells you which variable(s) define groups of cases.
- SPLIT FILE OFF. switches SPLIT FILE off.
SPSS Split File - Notes
- Note that cases must be sorted by the split variable(s) before switching SPLIT FILE on.
- When SPLIT FILE is in effect, the status bar informs you on this as shown in the screenshot. In older SPSS versions it simply says “Split File On” but in more recent versions it also indicates which variable(s) define the split groups.We're not sure in which version this was changed but we'll add that information to this tutorial if we find out.
- By default, output for the different split groups are shown as layers in tables. Alternatively, you can have output for separate groups as separate tables by using the SEPARATE keyword as we'll demonstrate below.
SPSS Split File Example
We had our employees fill out a tiny questionnaire, the data of which are in employees.sav. We'd now like to explore these data separately for respondents with different education types. The syntax below gives and example of doing so by SPLIT FILE. It presumes you already have the data open.
SPSS Split File Syntax
*1. Sort cases before we can use split file.
sort cases by education_type.
*2. Split file and organize output as separate tables.
split file separate by education_type.
*3. Quick check.
show split file.
*4. Have a look at monthly_income.
descriptives monthly_income.
*5. Switch split file off.
split file off.
sort cases by education_type.
*2. Split file and organize output as separate tables.
split file separate by education_type.
*3. Quick check.
show split file.
*4. Have a look at monthly_income.
descriptives monthly_income.
*5. Switch split file off.
split file off.
THIS TUTORIAL HAS 2 COMMENTS:
By Bekzhan on March 1st, 2018
Best website in the world! Thanks a lot!
Best regards,
Bekzhan!
By Ogaramos on May 4th, 2022
Excellent site, thanks