Overview (CROSSTABS command)
CROSSTABS produces contingency tables showing the joint distribution of two or more variables that have a limited number of distinct values. The frequency distribution of one variable is subdivided according to the values of one or more variables. The unique combination of values for two or more variables defines a cell.
CROSSTABS can operate in two different modes: general and integer. Integer mode builds some tables more efficiently but requires more specifications than general mode. Some subcommand specifications and statistics are available only in integer mode.
Options
Methods for building tables. To build tables in general mode, use the TABLES subcommand. Integer mode requires the TABLES and VARIABLES subcommands and minimum and maximum values for the variables.
Cell contents. By default, CROSSTABS displays only the number of cases in each cell. You can request row, column, and total percentages, and also expected values and residuals, by using the CELLS subcommand.
Statistics. In addition to the tables, you can obtain measures of association and tests of hypotheses for each subtable using the STATISTICS subcommand.
Formatting options. With the FORMAT subcommand, you can control the display order for categories in rows and columns of subtables and suppress crosstabulation. With the SHOWDIM subcommand you can display a subset of the variables as table layers in the crosstabulation table.
Writing and reproducing tables. You can write cell frequencies to a file and reproduce the original tables with the WRITE subcommand.
Basic specification
In general mode, the basic specification is TABLES with a table list. The actual keyword TABLES can be omitted. In integer mode, the minimum specification is the VARIABLES subcommand, specifying the variables to be used and their value ranges, and the TABLES subcommand with a table list.
- The minimum table list specifies a list of row variables, the keyword BY, and a list of column variables.
- In integer mode, all variables must be numeric with integer values. In general mode, variables can be numeric (integer or non-integer) or string.
- The default table shows cell counts.
Subcommand order
- In general mode, the table list must be first if the keyword TABLES is omitted. If the keyword TABLES is explicitly used, subcommands can be specified in any order.
- In integer mode, VARIABLES must precede TABLES. The keyword TABLES must be explicitly specified.
Operations
- Integer mode builds tables more quickly but requires more workspace if a table has many empty cells.
- In integer mode, the PROP and BPROP keywords on the CELLS command are ignored. If no other cell contents are requested, no table will be produced.
- Statistics are calculated separately for each two-way table or two-way subtable. Missing values are reported for the table as a whole.
- In general mode, the keyword TO on the TABLES subcommand refers to the order of variables in the active dataset. ALL refers to all variables in the active dataset. In integer mode, TO and ALL refer to the position and subset of variables specified on the VARIABLES subcommand.
Limitations
The following limitations apply to CROSSTABS in general mode:
- A maximum of 200 variables named or implied on the TABLES subcommand
- A maximum of 1000 non-empty rows or columns for each table
- A maximum of 20 table lists per CROSSTABS command
- A maximum of 10 dimensions (9 BY keywords) per table
- A maximum of 400 value labels displayed on any single table
The following limitations apply to CROSSTABS in integer mode:
- A maximum of 100 variables named or implied on the VARIABLES subcommand
- A maximum of 100 variables named or implied on the TABLES subcommand
- A maximum of 1000 non-empty rows or columns for each table
- A maximum of 20 table lists per CROSSTABS command
- A maximum of 8 dimensions (7 BY keywords) per table
- A maximum of 20 rows or columns of missing values when REPORT is specified on MISSING
- The minimum value that can be specified is –99,999
- The maximum value that can be specified is 999,999