As you become better using SPSS Statistics software to clean data, you
will want to do quick comparisons of subgroups in your data, or to isolate one
group in particular. This is where split- file processing really shines. Split-file
allows you to compare groups on a given variable, or to run separate analyses on
two subgroups of your data. We are going to dive deeper into split-file
processing in SPSS.
By default, SPSS includes all of the cases in your data set. When you do an
analysis, however, SPSS allows you to split a file and then perform a separate
analysis for each subgroup. This allows you to see the descriptive statistics
for your groups separately. For data cleaning or data exploration, you can
split a numeric or scale variable by a nominal, ordinal, or a string variable.
When you use a split-file command, SPSS will quietly sort the cases before
splitting them. This is because the split file procedure creates a new subgroup
each time it encounters a different value for one of your grouping variables.
So, if you did not sort your data first, you would have dozens of categories, even
though you only had actually two groups. The sorting is done by default, so it's
nothing that you need to think about, unless you are using syntax. For this
example, we are using the demo.sav data set that comes with SPSS. To find
out how to open this data, set check the links in the description. We will use the
continuous variable "Income" as our scale variable, which we will split by "Gender"
our dichotomous, nominal or categorical variable. And if we need a second scale
variable, we will use "Age".
To split your data file into separate groups for analysis, go to Data -> Split File
Here we see the split-file dialog box. We are going to use the categorical
variable Gender to split the continuous variable Income. Begin by displaying the
variable names, using a right-click. For this first example, we're going to get
the results from all split file groups in the same table. Select Compare groups
and then move gender into the box Groups Based on: If the file was already sorted
by gender, you could save a few milliseconds of processing time by
selecting "File is already sorted." This only really matters if you have a very
large data set, or a really slow computer. We will let SPSS sort our data for us.
Click OK.
Now that we have split the file, we are ready to analyze the income variable.
We will do two analyses. First, we'll get some descriptive statistics, and then we
will do a correlation. Go to Analyze -> Descriptive Statistics -> Frequencies.
We will use the income variable. Click on Statistics and choose mean, median,
standard deviation. Now click Continue. Let's turn off the frequency tables and
click OK. For the second analysis we are going to
analyze using a scale variable. Go to Analyze -> Correlate -> Bivariate. We will
correlate Income with the scale variable Age ...and click OK. Here we see the results
for males and again for females. Both are in the same table. The correlation
matrices are in the same pivot table. So this would be useful to quickly compare
the descriptive statistics for each group.
Let's run a different analysis in which we keep the groups separate. Use the
dialogue recall button to bring back the split file dialog box. This time, select
organize output by groups. We are already using the gender variable, so click OK.
We see that the split file is still on, so any analyses that we run will be
presented in two pivot tables: one table for females and one table for males.
Use the dialog recall button to rerun our previous frequency analysis. Click OK.
And we can rerun the correlation. We see that the pivot tables for the
descriptive statistics are now created separately. SPSS has also created
separate correlation matrices, one for males and one for females. This technique
would be most useful if we really only wanted to use the findings for one
subgroup, so we could just ignore the other group, or if we wanted to display
split findings side-by-side, for example on a poster. Now we need to know how to
turn the split file processing on and off. After you split the file, the split
remains in effect for the rest of the session until you turn it off. A message
"Split by gender" appears in the status bar here at the bottom of the
application window. It tells you that the split file processing is still in effect.
To turn it off, go to Data -> Split file. Set the button to "Analyze all cases". You can
click OK, or a second option is to simply click the Reset button. Either of these
options will turn off split file processing.
This is also easy to do with syntax, using the command SPLIT FILE OFF.