Our tutorials reference a dataset called "sample" in many examples. If you'd like to download the sample dataset to work through the examples, choose one of the files below:
A codebook is a document containing information about each of the variables in your dataset, such as:
Codebooks can also contain documentation about when and how the data was created. A good codebook allows you to communicate your research data to others clearly and succinctly, and ensures that the data is understood and interpreted properly.
Many codebooks are created manually; however, in SPSS, it's possible to generate a codebook from an existing SPSS data file.
To get the most out of the Codebooks procedure in SPSS, your dataset should already have variable labels and value labels applied before you run the Codebooks procedure. If you are not familiar with variable properties, such as labels or measurement levels, or concepts like value labeling of category codes in SPSS, you should read the Defining Variables tutorial before continuing.
This codebook method prints most of the information found in the Variable View window. It gives the names, labels, measurement levels, widths, formats, and any assigned missing values labels for every variable in the dataset. It also prints a table with the assigned value labels for categorical variables.
You can generate this simple codebook using the point-and-click menus, or using syntax.
DISPLAY DICTIONARY.
This codebook method includes all of the same information as the simple method, but also includes options for printing summary statistics as well. Unlike the simple method, you can choose which variables are included in the codebook, and you can choose which variable properties are included in the summary. Also unlike the simple method, the summary information for each variable will be printed in its own table.
You can generate this detailed codebook using the Codebooks dialog window, or using syntax.
Note: This procedure was introduced in SPSS version 17 (source: SPSS v23 Command Syntax Reference). If you are using an older version of SPSS, this command is not available - it will not appear in the menus, and running the syntax will return error messages.
CODEBOOK <variables-names-here>
/VARINFO POSITION LABEL TYPE FORMAT MEASURE ROLE VALUELABELS MISSING ATTRIBUTES
/FILEINFO NAME CASECOUNT
/OPTIONS VARORDER=VARLIST SORT=ASCENDING MAXCATS=200
/STATISTICS COUNT PERCENT MEAN STDDEV QUARTILES.
Note: When listing the variable names in the syntax, the assigned measurement level must be given in brackets after each variable name: [s] for scale, [n] for nominal, [o] for ordinal.
To reproduce this example, download the sample SPSS dataset and SPSS syntax file. Run the syntax file on the sample data. This will add all of the appropriate variable labels and value labels for this dataset.
When sharing your data with others, it's important that your variables are properly documented. This includes having succinct but descriptive labels for your variables, and labels for any numeric codes used for categories.
If you receive a dataset from a collaborator, you can get an overview of its contents by running the Display Dictionary procedure.
To generate a simple codebook for the sample data, click File > Display Data File Information > Working File.
DISPLAY DICTIONARY.
The first table is the Variable Information table. This table summarizes variable-level information, including:
The second table is the Variable Values table. This table will only appear if you have value labels defined for at least one variable in your dataset; otherwise, it is omitted. This table prints the name of each variable with defined value labels, and lists each code and associated label for that variable.
Qualtrics users: This procedure works well with survey data that you've downloaded from Qualtrics in SPSS format. Use it to check the coding of your multiple choice items!