Explicit Category Specification (CTABLES command)
The explicit category specification is a bracketed list of data values or value ranges in the order in which they are to be displayed in the table. Values not included in the list are excluded from the table. This form allows for subtotals and showing or hiding of specific values (both ordinary and user-missing).
- The list can include both ordinary and user-missing values but not the system-missing value (.).
- Values are optionally separated by commas.
- String and date values must be quoted. Date values must be consistent with the variable's print format.
- The
LO
,THRU
, andHI
keywords can be used in the value list to refer to a range of categories.LO
andHI
can be used only as part of a range specification. - The
MISSING
keyword can be used to refer to all user-missing values. - The
OTHERNM
keyword can be used to refer to all nonmissing values that are not explicitly named in the list. The keyword can be placed anywhere within the list. The values to which it refers appear in ascending order. - If a value is repeated in the list, the last instance
is honored. Thus, for a variable RATING with integer values 1 through 5, the following specifications are
equal:
/CATEGORIES VARIABLES = RATING [1,2,4,5,3] /CATEGORIES VARIABLES = RATING [1 THRU 5,3] /CATEGORIES VARIABLES = RATING [OTHERNM,3]
- For a multiple dichotomy set, you can order the variables in the set by using the names of the variables in the set. The variable names are not enclosed in quotation marks.
- The
SUBTOTAL
keyword is used within a category list to request subtotals for a variable. The position of a subtotal within the list determines where it will appear in the table and the categories to which it applies. By default, a subtotal applies to all values that precede it up to the next subtotal. IfPOSITION=BEFORE
is specified (See the topic Totals (CTABLES command) for more information. ), subtotals apply to the categories that follow them in the list. Hierarchical and overlapping subtotals are not supported. You can specify a label for a subtotal by placing the label in quotation marks immediately following theSUBTOTAL
keyword and an equals sign, as illustrated in the following example:
Example
CTABLES /TABLE AGECAT
/CATEGORIES VARIABLES=AGECAT [1, 2, 3, SUBTOTAL='Subtotal < 45',
4, 5, 6, SUBTOTAL='Subtotal 45+'].

- The
HSUBTOTAL
keyword functions just like theSUBTOTAL
keyword, except that only the subtotal is displayed in the table; the categories that define the subtotal are not included in the table. So you can useHSUBTOTAL
to collapse categories in a table without recoding the original variables.
Example
CTABLES /TABLE AGECAT
/CATEGORIES VARIABLES=AGECAT [1, 2, 3, HSUBTOTAL='Under 45',
4, 5, 6, HSUBTOTAL='45 or older']..
