Cross-tabulating data

Concept Information

CROSSTAB command

Cross-tabulating groups the records in a table based on identical combinations of values in two or more key fields, and counts the number of records in each group. Key fields can be character or numeric.

The resulting groups are displayed in a grid of rows and columns, similar to a pivot table, that allows you to visualize relations and patterns in the data.

For example, you could cross-tabulate an inventory table on the Product Location and Product Class fields to find the number of records in each class at each location.

Key field 1

(Product Location)

Key field 2

(Product Class)

Cross-tabulated group

(Product Location and Product Class)

Record count
A-01 17 A-01 16 1
F-19 22 A-01 17 3
F-19 08 B-03 17 2
A-01 16 F-19 22 2
B-03 17 F-19 08 1
Q-28 03 Q-28 03 1
A-01 17      
F-19 22      
A-01 17      
B-03 17      

Subtotaling numeric fields

When cross-tabulating, you can optionally subtotal one or more numeric fields. In the example above, you could subtotal the inventory value field to find the total inventory value for each product class at each location.

Cross-tabulating is similar to summarizing

Cross-tabulating is similar to summarizing using two fields. In both operations the counts and subtotals in the output results are the same, but the information is arranged differently.

Cross-tabulating also displays counts and subtotals of zero, which summarizing does not. Depending on the type of analysis you are doing, displaying counts and subtotals of zero can be useful.

Cross-tabulating and sorting

You can cross-tabulate sorted or unsorted tables. When you cross-tabulate an unsorted table Analytics automatically sorts the output results as part of the cross-tabulate operation.

Cross-tabulating in detail

Cross-tabulating performs the following operations:

Operation Location in Cross-tabulate results
Groups the records based on identical combinations of values in two or more character or numeric fields, and displays the groups in a grid of rows and columns intersections of Cust Number field (rows) and Type field (columns)
Optionally subtotals the values of one or more numeric fields for each group Amount field
Optionally counts (subtotals) the number of records for each group

Note

Counts are automatically included if you do not select any subtotal fields.

Count field

Provides totals for all columns included in the output results

Totals row

Cross-tabulate results

Output results produced by:

  • cross-tabulating customer number and transaction type in an accounts receivable table

    (the Ar table in ACL DATA\Sample Data Files\Sample Project.ACL)

  • subtotaling transaction amount
  • outputting the results to screen

Steps

You can cross-tabulate data by grouping the records in a table based on identical combinations of values in two or more character or numeric fields.

The resulting groups are displayed in a grid of rows and columns, similar to a pivot table, that allows you to visualize relations and patterns in the data.