You are here: Commands > Cross Tabulate

Cross Tabulate

Menu: Found in the ANALYZE menu

Cross Tabulate lets you analyze character fields by setting them in rows and columns. By cross-tabulating character fields, you can produce various summaries, explore areas of interest and accumulate numeric fields. You can use Cross Tabulate to produce results as a file, table or graph.

Cross Tabulate counts the number of records in a file and:

Counts each row value within each column value
Accumulates numeric fields for each row value within each column value
Totals the amounts for each column value
Optionally, includes a COUNT column to the output, which displays the number of records counted for each category

To send the results to a graph, click the [More] button and select the Graph “Output Option” in the dialog or double-click the command or table output in the Command Log. For more information, see Graph Output. For information on changing the graph’s appearance, see Customizing Graphs.

Parameters

The Cross Tabulate command has the following command parameters: Append, First, Graph, If, Next, Noformat, Open, Screen, To and While. For a description of the common parameters, see Command Parameters. For a description of supported field modifiers see Field Modifiers.

On

Specifies the fields or expressions to use as rows. In the command dialog, select the fields from the “Rows” list box or click [Choose] to display the Selected Fields dialog. For more information on the Selected Fields dialog, see Selection/Edit Dialog Boxes.

Accumulate

Specifies the numeric fields or expressions to be totalled. In the command dialog, select the fields to total from the “Fields to accumulate” list box or click [Choose] to display the Selected Fields dialog.

Columns

Specifies the field or expression to use as a column. In the command dialog, select the field from the “Columns” pull-down list or click [Choose] to display the Selected Fields dialog.

Count

Select this option to include record counts as columns. This is useful when you use the Accumulate parameter. In the command dialog, check the “Include Count” checkbox.

Command Mode Syntax

CROSSTAB ON row_fields COLUMNS column_field

<ACCUMULATE numeric_fields> <COUNT>

<TO data-file-name|SCREEN|GRAPH>

<IF test> <WHILE condition> <FIRST n> <NEXT n>

<NOFORMAT> <APPEND>¿

 

row_fields specifies the fields or expressions to use for rows. You can specify multiple fields or expressions for the rows.
column_field specifies the field to use for columns. You can specify only one field or expression for the columns.
numeric_fields specifies the numeric fields or expressions to accumulate.
COUNT adds an optional Count column to the output, which displays the number of records counted for each category.