If multiple elements of the list cover a given category, the last one
in the list takes precedence.
-@c TODO example
+The following example syntax and output show how an explicit category
+can limit the displayed categories:
+
+@example
+CTABLES /TABLE qn1.
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1, 2, 3].
+@end example
+@psppoutput {ctables27}
@node CTABLES Implicit Categories
@subsubsection Implicit Categories
@code{MISSING=EXCLUDE}. Specify @code{MISSING=INCLUDE} to include
user-missing values. The system-missing value is always excluded.
-@c TODO example
+The following example syntax and output show how
+@code{MISSING=INCLUDE} causes missing values to be included in a
+category list.
+
+@example
+CTABLES /TABLE qn1.
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=INCLUDE.
+@end example
+@psppoutput {ctables28}
@node CTABLES Totals and Subtotals
@subsubsection Totals and Subtotals
@code{SUBTOTAL="@i{label}"} or @code{HSUBTOTAL="@i{label}"} to specify
a custom label.
-@c TODO
+The following example syntax and output show how to use
+@code{TOTAL=YES} and @code{SUBTOTAL}:
+
+@example
+CTABLES
+ /TABLE qn1
+ /CATEGORIES VARIABLES=qn1 [OTHERNM, SUBTOTAL='Valid Total',
+ MISSING, SUBTOTAL='Missing Total']
+ TOTAL=YES LABEL='Overall Total'.
+@end example
+@psppoutput {ctables29}
By default, or with @code{POSITION=AFTER}, totals are displayed in the
output after the last category and subtotals apply to categories that
precede them. With @code{POSITION=BEFORE}, totals come before the
first category and subtotals apply to categories that follow them.
-@c TODO
-
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.
+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
+categorical @code{region} variable, as shown:
-@c TODO
+@example
+CTABLES /TABLE=region > qn20 [MEAN, VALIDN]
+ /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
+@end example
+@psppoutput {ctables30}
By default, @pspp{} uses the same summary functions for totals and
subtotals as other categories. To summarize totals and subtotals