I have taught you about exploring your data with SPSS, but there is another very important way that
you want to be able to explore your data: with your own eyes. Now, I’m going to show you how to
summarize your data, in an easily human readable format, using the codebook in IBM SPSS Statistics.
To find the DogToys3.sav SPSS data set that I’m using for this example,
click on the link in the description for a Google Drive folder.
If you have been following along with our data project so far, you now know that SPSS
makes it very easy to analyze data. You may also have noticed that our dog toys data set
has been growing, as we create new variables. But what if you had not been following along?
What if you encountered this data set knowing nothing about the previous training videos?
What if I want to collaborate with you and I want to show you the most important information about
the dog toys data, like some of the summary statistics and the structure of the variables?
The answer is to create a codebook of the data set. A codebook
reports the dictionary information, such as variable names, variable labels,
value labels, missing values, and the summary statistics, for all of your variables,
or for just the variables that you specify. The nominal and ordinal variables are summarized as
counts and percentages. Scale variables are summarized with the mean standard deviation
and quartiles. A codebook is also a handy way to archive your data for reference
while you are doing an analysis, and later when you return to the data and want to remember
what was in that data set, you will have the codebook to guide you. So, let's do it.
From the menus choose Analyze -> Reports -> Codebook. The codebook window opens.
We are on the Variables tab. Now, for this lesson, I’m actually going to create this codebook twice:
the first time, I’m going to turn on all of the options, so that you can learn what all of the
options do, but then I’m going to scale back to just the options that I recommend for your
finished codebook. I want to show you the results that you get for each level of measurement,
so we will choose examples of nominal, ordinal, scale, and string variables. For this example,
I will choose the Unique Identification Number. I'm double-clicking on the variable
to move it over. And then both of my scale variables, Toys Owned, and Days To Fail.
I will choose the nominal version of Favorite Toy, Dog Breed,
Size Of Dog (which is actually ordinal), Toy Chosen, and the string variable
Favorite Toy Of Five. I will use these same variables for the second codebook, as well.
Now click on the Output tab. This first time through, we will turn on all of the options.
The Variable Information options are on by default.
This tells us the Position of the variable in the file order, the Variable Label, the Variable Type
(such as numeric or string), the Display Format for the variable (such as a4 or f8.2 or date11).
The Measurement scale will be nominal, ordinal, or scale. This is the role of the variable in the
analysis. Variable labels for each categorical variable, any user-defined missing values,
we did not define any custom attributes or reserved attributes, but we will leave them
as-is because they will not produce any output, anyway.
All of the file information is optional and related to the file as a whole. File name
is the data file. Location is where the file is located on your computer. The
number of cases in the active data set, any File Labels that have been defined,
data file document text, if weighting is turned on the name of the weight variable will be displayed,
and again any custom attributes or reserved attributes that have been defined. When I selected
which variables I wanted to analyze, I entered them in the order that I wanted them to appear.
That is the Variable List setting. We could however sort them by Alphabetical order,
or in the order in which they already appear in the data set itself - either first to last
or last to first - or we can sort them by nominal, ordinal, and scale measurement level.
But I prefer to keep them in the order that I chose when I selected my list of variables.
If you have a categorical variable (or a mislabeled string variable) with more than
200 categories, that output is unusable, and it would be suppressed. You can adjust the number of
categories to your specifications. The Statistics tab allows you to control the summary statistics
that are included in the output, or to suppress the display of the summary statistics, entirely.
SPSS will display the summary statistics appropriate to the level of measurement: counts
and percentages for categorical variables; mean, standard deviation, and quartiles
for scale variables. And that is all of our settings so we can click Ok.
In the Viewer we see our codebook. Our purpose now is to see what information we have
and then determine what information we want to keep for our final codebook. The first results
are for the file information. I like knowing the name and location of the file,
especially if I put my data set in a folder where it will stay long-term.
Label and weight are useless, but I do like knowing the number of cases.
The next results are for the unique identification number. There is a single number for each dog,
and this is not very useful. I'm going to remove this variable entirely.
Toys Owned and Days to Fail are both scale variables. I'm not particularly interested
in their position in the data. Now, labels are nice. I already know they're numeric.
The F in the format indicates that they are numeric. The F3 tells us the width setting
of the data. Again, not particularly useful. I do like knowing the measurement,
but the role is not really used in SPSS, so I’ll drop it. Because these are scale variables
we get mean, standard deviation, and the quartiles for the descriptive statistics. For categorical
variables, like breed and favorite toy, knowing the value labels will be very important.
For categorical variables, we get counts and percents. I like that the ordinal variable size of
dog is better when we know the value labels again, we get counts and percentages for the categories.
At the bottom, the string variable is identified as a “A14” for a string variable 14 units wide.
And we get the names of the categories, instead of the numbers with their labels remember. We already
have this same variable in a numeric form, so I am just going to drop the string version. Great! Now,
I know what settings I really want, so let's dial in exactly the right combination for our codebook.
Instead of using the drop-down menus, use the recall recently used dialogs icon
to re-open the codebook settings. In the Variables box, I’m going to remove the Unique Identifier
and the string variable. For the output, under Variable Information, I’m going to choose only
the Label, the Measurement Level, and the Value Labels, and the count of any Missing Values.
For the File Information, I’m going to keep only File Name, Location, and the number of cases.
And for the statistics, I want to keep counts and percentages for the categorical variables.
The mean and the standard deviation will do for the scale variables,
but I’m going to turn off quartiles. Now, Click ok once again.
The Viewer pops up with our output. Because I ran this analysis twice, I now have two codebooks.
Select the first codebook in the tree diagram to highlight all of its output and delete it.
Now, I have a summary of each important variable in my data set.
I can export to Word or I prefer to export the codebook to Excel, to do some cleaning.
And I save it all to my desktop.
Let's review what you have learned. You can create a codebook for your variables. You have learned an
underutilized SPSS skill that will be extremely useful to you when you
begin working with multiple data sets or begin sharing data with others on your research team.
In our next video, I’m going to wrap up this series putting together all of the pieces and show
you exactly how a professional statistician uses SPSS in the real world. I hope to see you there.