15.7 CTABLES

CTABLES has the following overall syntax. At least one TABLE subcommand is required:

CTABLES
  ...global subcommands...
  [/TABLE axis [BY axis [BY axis]]
   ...per-table subcommands...]...

where each axis may be empty or take one of the following forms:

variable
variable [{C | S}]
axis + axis
axis > axis
(axis)
axis [summary [string] [format]]

The following subcommands precede the first TABLE subcommand and apply to all of the output tables. All of these subcommands are optional:

/FORMAT
    [MINCOLWIDTH={DEFAULT | width}]
    [MAXCOLWIDTH={DEFAULT | width}]
    [UNITS={POINTS | INCHES | CM}]
    [EMPTY={ZERO | BLANK | string}]
    [MISSING=string]
/VLABELS
    VARIABLES=variables
    DISPLAY={DEFAULT | NAME | LABEL | BOTH | NONE}
/SMISSING {VARIABLE | LISTWISE}
/PCOMPUTE &postcompute=EXPR(expression)
/PPROPERTIES &postcompute...
    [LABEL=string]
    [FORMAT=[summary format]...]
    [HIDESOURCECATS={NO | YES}
/WEIGHT VARIABLE=variable
/HIDESMALLCOUNTS COUNT=count

The following subcommands follow TABLE and apply only to the previous TABLE. All of these subcommands are optional:

/SLABELS
    [POSITION={COLUMN | ROW | LAYER}]
    [VISIBLE={YES | NO}]
/CLABELS {AUTO | {ROWLABELS|COLLABELS}={OPPOSITE|LAYER}}
/CATEGORIES VARIABLES=variables
    {[value, value...]
   | [ORDER={A | D}]
     [KEY={VALUE | LABEL | summary(variable)}]
     [MISSING={EXCLUDE | INCLUDE}]}
    [TOTAL={NO | YES} [LABEL=string] [POSITION={AFTER | BEFORE}]]
    [EMPTY={INCLUDE | EXCLUDE}]
/TITLES
    [TITLE=string...]
    [CAPTION=string...]
    [CORNER=string...]

The CTABLES (aka “custom tables”) command produces multi-dimensional tables from categorical and scale data. It offers many options for data summarization and formatting.

This section’s examples use data from the 2008 (USA) National Survey of Drinking and Driving Attitudes and Behaviors, a public domain data set from the (USA) National Highway Traffic Administration and available at https://data.transportation.gov. PSPP includes this data set, with a modified dictionary, as examples/nhtsa.sav.