Totals (CTABLES command)

A total can be specified for any category variable regardless of its level of nesting within a dimension. Totals can be requested in more than one dimension. The following options are available:

TOTAL. Whether to display a total for a variable. You can specify TOTAL=NO (the default) or TOTAL=YES.

LABEL. The label for the total. The specification is a quoted string.

POSITION. Whether a total comes after or before the categories of the variable being totaled. You can specify AFTER (the default) or BEFORE. POSITION also determines whether subtotals that are specified in an explicit list of categories apply to the categories that precede them (AFTER) or follow them (BEFORE).

Scale variables cannot be totaled directly. To obtain a total or subtotals for a scale variable, request the total or subtotals for the category variable within whose categories the summaries for the scale variable appear.

Example

CTABLES /TABLE AGECAT 
  /CATEGORIES VARIABLES=AGECAT TOTAL=YES LABEL='Total Respondents'.
Figure 1. Table with total count for a categorical variable
Table with total count for a categorical variable

Example

CTABLES /TABLE AGE [MEAN 'Average' F5.1] > SEX
  /CATEGORIES VARIABLES=SEX TOTAL=YES LABEL='Combined'.
Figure 2. Table with combined summary of a scale variable
Table with combined summary of a scale variable
  • The summary function for AGE appears in cells that are determined by the values of SEX. The total is requested for SEX to obtain the average age across both sexes.