CATEGORIES also controls display of totals and subtotals. By
default, or with
TOTAL=NO, totals are not displayed. Use
TOTAL=YES to display a total. By default, the total is labeled
LABEL="label" to override it.
Subtotals are also not displayed by default. To add one or more
subtotals, use an explicit category list and insert
HSUBTOTAL in the position or positions where the subtotal
should appear. The subtotal becomes an extra row or column or layer.
HSUBTOTAL additionally hides the categories that make up the
subtotal. Either way, the default label is “Subtotal”, use
HSUBTOTAL="label" to specify
a custom label.
The following example syntax and output show how to use
CTABLES /TABLE freqOfDriving /CATEGORIES VARIABLES=freqOfDriving [OTHERNM, SUBTOTAL='Valid Total', MISSING, SUBTOTAL='Missing Total'] TOTAL=YES LABEL='Overall Total'.
By default, or with
POSITION=AFTER, totals are displayed in the
output after the last category and subtotals apply to categories that
precede them. With
POSITION=BEFORE, totals come before the
first category and subtotals apply to categories that follow them.
Only categorical variables may have totals and subtotals. Scalar
variables may be “totaled” indirectly by enabling totals and
subtotals on a categorical variable within which the scalar variable
is summarized. For example, the following syntax produces a mean,
count, and valid count across all data by adding a total on the
region variable, as shown:
CTABLES /TABLE=region > monthDaysMin1drink [MEAN, VALIDN] /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
By default, PSPP uses the same summary functions for totals and
subtotals as other categories. To summarize totals and subtotals
differently, specify the summary functions for totals and subtotals
after the ordinary summary functions inside a nested set of
TOTALS. For example, the following syntax displays
COUNT for individual categories and totals and
for totals, as shown:
CTABLES /TABLE isLicensedDriver [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=isLicensedDriver TOTAL=YES MISSING=INCLUDE.