SPSS tutorials website header logo SPSS TUTORIALS BASICS ANOVA REGRESSION FACTOR CORRELATION

Creating APA Style Contingency Tables in SPSS

Running simple contingency tables in SPSS is easy enough. However, the default format is inconvenient and doesn't meet APA standards. This tutorial walks you through 3 options for creating the desired tables:

We'll use bank_clean.sav -partly shown below- for all examples. You can try them yourself after downloading the data.

SPSS Bank Sav Data View

So What Are Contingency Tables Anyway?

Contingency tables show frequencies for all
combinations of values of 2(+) variables.
For example, the table below shows a contingency table -or “crosstab”- for 2 variables: marital status and education level.

Simple Example Contingency Table

Only 1 respondent had middle school and never married;
A total of 123 respondents never married;
Only 4 respondents have middle school or lower;
The table shows all combinations of marital status and education for 442 respondents.

Hopefully, contingency tables give some insight into the association -if any- between these variables. So how does that work? For a very simple explanation, see

Running Simple Contingency Tables in SPSS

The fastest way to create the table we just saw is running one line of SPSS syntax: crosstabs educ by marit. The categories of the first variable -educ or education- become rows in the table. The values of the second variable -marit or marital status- become the columns. As a rule of thumb, the columns hold the groups you want to compare on whatever goes into the rows. In this case, we're comparing marital status groups on education level.
If we had wanted to do the reverse -compare education level groups on marital status- we'd swap the rows and columns and run crosstabs marit by educ.

CROSSTABS with Column Percentages

Right. So how do our groups compare on education level? It's hard to see from our first table because each marital status group has a different n or sample size. We may see more of a pattern if we add column percentages. The syntax below does just that.

*Show only variable labels and value labels in following output tables.

set
tvars labels
tnumbers labels.

*Create contingency table with frequencies and column percentages.

crosstabs educ by marit
/cells count column.

Result

SPSS Contingency Table Frequencies Column Percentages

If we study the entire table, it seems that widowed respondents are somewhat higher educated than the others: no less than 56.8% hold a master's degree and another 13.5% even a PhD. The overall pattern is not very clear though and we'd perhaps better visualize it as a stacked bar chart.
In any case, the table format -percentages in rows- doesn't really help either and doesn't meet APA guidelines. So let's fix it.

Converting CROSSTABS to APA Tables

One solution is right-click our table and select Edit content SPSS Menu Arrow In Separate Window In the pivot editor that opens, tick Pivoting trays as shown below.

SPSS Apa Contingency Tables Rearrange Table Dimensions 1

Now drag and drop statistics right underneath Marital status and just close the window.

SPSS Rearrange Table Dimensions

Let's now make 2 text replacements:

Using the Ctrl + H shortkey in the output viewer should work. Or -much nicer- use the OUTPUT MODIFY syntax below if you're on SPSS version 22 or higher.

*Optionally: set proper column headers.

output modify
/select tables
/tablecells select = ['% within Marital status'] replace = '%' applyto = columnheader
/tablecells select = ['Count'] replace = 'n' applyto = columnheader.

Result

SPSS Apa Contingency Table From Crosstabs APA Contingency Table Created with CROSSTABS

So that's the easiest way to create an APA style contingency table in SPSS. But -personally- I find it too much work, especially for several tables. So let's consider 2 alternatives.

APA Contingency Tables from CTABLES

The table we just created can be run in one go with CTABLES. However, this only works if you've a license for the custom tables module. You can check this by running show license. If the resulting table includes “Custom Tables”, try the syntax below.

*Create APA style contingency table with ctables.

ctables
/table educ by marit [count 'n' colpct '%']
/categories variables = educ marit total = yes.

Result

SPSS Apa Contingency Table From Ctables APA Contingency Table Created with CTABLES

CTABLES works great for this table but -unfortunately- you'll need a separate command for each table. The syntax is also somewhat challenging. I think you could paste it from Analyze SPSS Menu Arrow Tables SPSS Menu Arrow Custom Tables but I somehow never get the results I want from the menu.
A better way perhaps is to copy-paste-edit the syntax example for several tables. Or create and run the commands with Python for SPSS. This is faster but also harder. But if you like it fast and hard -I surely do- then go for it.

APA Contingency Tables from TABLES

So what if you don't have a license for CTABLES? Well, then there's TABLES. TABLES was replaced by CTABLES around 1990 and removed from all documentation. But -as very very few SPSS users know- TABLES still works in all recent SPSS versions.
Like so, the syntax below is an alternative for the CTABLES approach.

*Create APA style contingency table with tables.

tables
/format zero
/ftotal = ftot 'Total'
/table educ + ftot by marit > (statistics) + ftot
/statistics count((f3) 'n') cpct((pct5.1) '%':marit).

Result

SPSS Apa Contingency Table From Tables APA Contingency Table Created with TABLES

This contingency table is almost identical to the CTABLES result. Unfortunately, the syntax is even harder and -worse- not documented. We might build a tool for creating the TABLES command from the menu but it won't come up any time soon.

Final Notes

We showed 3 ways for creating APA style contingency tables in SPSS:

Admittedly, none of these options is ideal. So we might build a tool some time that runs many tables in one go from the menu.

Thanks for reading!

Tell us what you think!

*Required field. Your comment will show up after approval from a moderator.