Every analysis that we do using IBM SPSS Statistics software involves Data, but
unless you are always collecting your own data, you are sure to run into
datasets that are not structured the way that you need them to be.
Fortunately, SPSS gives us some powerful tools to modify data structures.
We are going to dive deeper into modifying data in SPSS to get them ready to analyze.
We are going to do something in this video that you may have been told is a
bad idea: We're going to take a continuous scale
variable and turn it into a categorical variable. So, why is this a bad idea?
In life, there are many things that you can do, that you probably shouldn't do.
And of all of the bad life choices that you can make, one of the least rewarding
is dichotomizing scale variables. You simply split a scale variable into its
upper and lower halves. Don't do that. It treats data that are very different as
being the same and data that are very similar as being different.
Now back before we had computers widely available to help us do stats, sometimes
researchers would split a continuous variable into two, or even three parts,
and then use it in an ANOVA. Don't do that. If you have two scale variables then
use a correlation or a multiple regression, rather than dichotomizing a
continuous variable. That said, there are legitimate reasons for creating a
categorical variable from a continuous scale variable... none of which involve
using the resulting categories in inferential statistics. For this example,
we will continue using the demo.sav dataset that comes with SPSS.
One of the reasons that you may want to create categorical data from scale data is to
create age bands for the ages of your participants. Now, of course, when we
create ranges of data based on predetermined bands, there may or may not
be people in each band. For example, we could have a band for people over age 65,
but there were no people over age 65 in our survey, so that band would be empty.
Instead of making our data fit into pre-selected bins, we could just divide
our data into ranges based upon the values in the data
themselves. For example, we want to divide our data into four equal parts.
Those are called quartiles. Five equal parts is called quintiles. And ten equal
parts is called deciles. If we break our data
into hundredths, that is called percentiles.
If all that you want to do is to know how many scores are in each quartile, quintile, or
decile, the simplest way is to use the Frequencies command. This technique will
show you the quartiles, etc., but it does not create a new variable. Go to Analyze ->
Descriptive Statistics -> Frequencies. Move the variable "age" into the Variables box.
Click on Statistics. Under Percentile Values, we can create quartiles very
easily. Click on quartiles. Click Continue. Let's turn off the option for frequency
tables, or else we'll have a huge, unmanageable, and unnecessary table.
And we will click OK. The table says "percentile", but these are actually the
cut points for quartiles. The 25th percentile is the first quartile.
The fiftieth percentile is also the median, and the 75th percentile is the top
quartile. Use the dialog recall button to bring back the Frequencies dialog box.
And click on Statistics. If we wanted quintiles - or some other division - we
would use the "Cut points for:" option. By default, we have cut points for 10 equal
groups, and that is deciles. Uncheck quartiles, or else we would get both in a
single table, which is a little difficult to read. Click Continue...
and click OK. Again, the table says percentile, but these are tenths of a
percentile or deciles. To get quintiles - or five equal groups - we
will customize the settings. Use the dialog recall button to bring back the
Frequencies dialog box, and click on Statistics. Quintiles are five equal
groups. Click Continue and click OK, and here are the cut points for the
quintiles. We could set the number of categories to any value that we would
like, depending upon our data. As I said, this technique tells us where the bands
are, but it does not modify the data in any way. If you want to create a variable
that recodes all of the values into quartiles, quintiles, or something else, we
would use a different technique. This technique for creating categories from a
scale variable is called "visual binning." The term "bin" refers to taking two or
more contiguous values and grouping them into the same category. So if your age is
between 18 and 25 years old, you would be in the 18 to 25 "bin". We create bins of
numbers based upon the data. Where would we use quartiles? Here is a map of death
rates per 100,000 for each state in the U.S. The data from all 50 states have been
divided into bins, each containing 25% of the data.
States are labeled based upon which quartile they are in. The darker the
color, the higher the death rate in that state. This allows us to spot patterns.
We can see which states have the highest death rates, which are above the median,
which are below the median, and which states have the lowest rates.
Let's create a new variable that actually contains the quartiles.
Go to Transform -> Visual Binning... Because visual binning relies on the actual
values in the data file to determine the size of the bins, SPSS needs to read the
data file first. This is usually pretty quick. Select age as the variable that
you want to bin, and click Continue. Our demo.sav dataset contains more than
6,000 cases, but it doesn't take too long to scan the cases. We see age in our
scanned variables list, and here we see some information about the variable,
including its minimum, maximum, and a histogram of the bins. We will be
creating a new variable, so we will name it "AgeBin" in the Binned
Variable: box. Click Make Cutpoints... Select Equal Percentiles Based on
Scanned Cases. We want to create quartiles - or four equal groups - so for
the number of cut points, enter 3. The number of cut points is always 1 less
than the number of binned categories. We have four categories, with three cut
points. By default, the width is 25%, or one quarter of the cases. Click Apply.
We see that our histogram now contains some lines that show us where the quartiles
will be divided. These values are the cut points for the quartiles. They will
create categories - numbered 1 through 4. We should add some labels. This is
Q1, Q2, Q3, and Q4.
Alternatively, we could click on Make Labels. This gives us numeric values and,
unfortunately, the undo button doesn't work here, so only make labels if you are
certain that you don't want to create them yourself.
And click OK. The binning specifications that we entered will create one new
variable. Click OK. In Data View, we see our new variable "AgeBin" and in Variable
View, we see that this new variable has been properly labeled. Well, this can be
very useful for understanding your data. What you should not do, however, is to
create categorical variables from scale variables in order to use those
categories in an ANOVA, or to dichotomize a perfectly useful scale variable.
Next time the temptation seizes you to carve a continuous variable into the upper,
middle, and lower thirds, and then run an ANOVA... relax, don't do it... use a regression
equation instead.