Referencing Subtotals in a Computed Category
You can include subtotals in a computed category's expression.
This example uses the data file survey_sample.sav. See the topic Sample Files for more information.
- From
the menus, choose:
- Click Reset to clear any previous settings in the table builder.
- In the table builder, drag and drop Labor force status from the variable list into the Rows area of the canvas pane.
- Drag and drop Marital status from the variable list into the Columns area.
- Right-click Labor force status on the canvas pane and choose Categories and Totals from the pop-up menu.
- Select 2 in the Value(s) list.
- Click Add Subtotal to display the Define Subtotal dialog box.
- In the Label text field, type Working.
- Select Hide subtotaled categories from the table.
- Then click Continue.
This inserts a row containing the subtotal for the first two working status categories.
- Select 8 in the Value(s) list.
- Click Add Subtotal to display the Define Subtotal dialog box.
- In the Label text field, type Not Working.
- Select Hide subtotaled categories.
- Then click Continue.
This inserts a row containing the subtotal for the other working status categories.
- Select the Not Working subtotal in the Value(s) list.
- Click Add Category to display the Define Compute Category dialog box.
- In the Label for Computed Category text field, type Working / Not Working.
- Select Working (Working #1) in the Totals and Subtotals list and click the arrow button to copy it to the Expression for Computed Category text box.
- Click the division (/) operator button in the dialog box (or press the / key on the keyboard).
- Select Not Working (Not Working #2) in
the Totals and Subtotals list and click the arrow button to copy it
to the Expression for Computed Category text box.
By default, the computed category uses the same format as the variable's statistic, which is Count in this case. Because we want to show decimal places resulting from the division in the computed category's expression and the default format for Count does not include decimal places, we need to change the format.
- Click the Display Formats tab.
- Change the Decimals setting for Count to 2.
- Then click Continue.
- Click Apply and then click OK in the table builder to create the table.

The table includes two subtotals and a computed category. The computed category shows the ratio of the subtotals so that you can easily compare the groups represented by each subtotal. There's a much lower ratio of working to not working widowed respondents compared to the other groups. Also, there is a slightly lower ratio of married respondents, perhaps resulting from spouses who leave the workforce to stay home with a child.