SPSS CROSSTABS produces contingency tables: frequencies for one variable for each value of another variable separately. If assumptions are met, a chi-square test may follow to test whether an association between the variables is statistically significant. This tutorial, however, aims at quickly walking through the main options for CROSSTABS.

We'll use freelancers.sav throughout this tutorial as a test data file.

## SPSS CROSSTABS - Minimal Specification

The syntax below demonstrates the simplest possible CROSSTABS command. It generates a table with the frequencies for sector_2010 for each value in sector_2011 separately. The screenshot below shows the result.

***Minimal CROSSTABS command.**

crosstabs sector_2010 by sector_2011.

## SPSS CROSSTABS - CELLS Subcommand

By default, CROSSTABS shows only frequencies (counts). However, the association between variables usually become more visible by displaying row or **column percentages**. They can be obtained by adding a CELLS subcommand.

Note that multiple cell contents may be chosen simultaneously; the second example below includes both column percentages and frequencies. Specifying ALL on the CELLS subcommand gives a complete overview of the options.

***1. Crosstabs with (only) column percentages in cells.**

crosstabs sector_2010 by sector_2011/cells column.

***2. Crosstabs with both frequencies and column percentages in cells.**

crosstabs sector_2010 by sector_2011/cells count column.

## SPSS CROSSTABS - Multiway Tables

Multiway tables result from including more than one BY clause in CROSSTABS. Like so, the syntax below produces frequencies of sector_2011 for each combination of gender and sector_2010 separately. The following screenshot shows (part of) the result.

***Three way crosstab (or contingency table).**

crosstabs sector_2010

**by**sector_2011

**by**gender

/cells column.

## SPSS CROSSTABS - Multiple Tables, Similar Columns

Multiple tables with the same column variable but different row variables can be generated by a single CROSSTABS command; simply specify multiple variable names (possibly using TO) **before the BY keyword**. The syntax below gives an example.

***Multiple tables, same column variable, different row variables.**

crosstabs sector_2011 to sector_2014

**by**sector_2010.

## SPSS CROSSTABS - Multiple Tables, Similar Rows

Multiple variables being specified **after the BY keyword** results in multipe tables with different column variables but the same row variable.

***Multiple tables, same row variable, different column variables.**

crosstabs sector_2010

**by**sector_2011 to sector_2014.

## SPSS CROSSTABS - BARCHART Subcommand

Clustered barcharts can be obtained from CROSSTABS by simply adding a BARCHART subcommand as shown below. However, we prefer to generate such charts via GRAPH because it allows us to set appropriate titles for our charts.

Charts resulting from either option can be styled with an SPSS Chart Template (.sgt) file, which we used for the following screenshot.

***Crosstab with barchart.**

crosstabs sector_2010 by sector_2011

/cells column

/barchart.

## SPSS CROSSTABS - STATISTICS Subcommand

As mentioned in the introduction of this tutorial, CROSSTABS offers a chi-square test for evaluating the statistical significance of an association among the variables involved. It's obtained by specifying CHISQ on the STATISTICS subcommand.

Do keep in mind that SPSS happily produces test results even if their **statistical assumptions** don't hold, in which case such results may be wildly incorrect.

Besides the chi-square test statistic, many other statistics are available. For a full overview, specify ALL on the STATISTICS subcommand or consult the command syntax reference.

***Crosstabs with chi squared independence test.**

crosstabs sector_2010 by sector_2011

/cells column

/statistics chisq.

## This tutorial has 5 comments

## By BALUKU Geofrey on March 23rd, 2020

Wonderful

## By Ruben Geert van den Berg on September 15th, 2018

Hi Mohamed!

First question: no. You could, however, collect all these tables with OMS and edit the result somewhat. This may save some time if you have many tables or need to do this on a regular basis.

Second question: no. You could come a long way by using CTABLES (custom tables, requires additional license) but the counts and percentages will always be in separate columns with their own column headers.

Hope that helps!

## By Mohamed Rahouma on September 15th, 2018

Hi

I want to know if there is any way to get output for chi square for several variables (rows) in 1 polished table as in any published paper? Is it possible to report event numbers and % in the same cell with % reported between brackets

Regards

M.Rahouma

## By Ruben Geert van den Berg on May 30th, 2016

For Kendall's Tau-B, just see SPSS - Kendalls Tau B from CROSSTABS or NONPAR CORR.

## By Eddie on January 19th, 2016

Simple and straight forward