Specifying Summaries (CTABLES command)
You can specify one or more summary functions for variables in any one dimension. For category variables, summaries can be specified only for the variables at the lowest nesting level. Thus, in the table expression
/TABLE SEX > (HAPPY + HAPMAR) BY AGECAT
you can assign summaries to HAPPY and HAPMAR or to AGECAT, but not to both and not to SEX.
If a scale variable appears in a dimension, that dimension becomes the statistics dimension, and all statistics must be specified for that dimension. A scale variable need not be at the lowest level of nesting. Thus, the following is a valid specification:
CTABLES /TABLE AGE [MINIMUM, MAXIMUM, MEAN] > SEX > HAPPY.
A multiple response variable also need not be at the lowest level of nesting. The following specification is a valid specification:
CTABLES /TABLE $MLTCARS [COUNT, RESPONSES] > SEX.
However, if two multiple response variables are nested, as in $MULTCARS > $MULTNEWS, summaries can be requested only for the variable at the innermost nesting level (in this case, $MULTNEWS).
The general form for a summary specification is
[summary 'label' format, ..., summary 'label' format]
- The specification follows the variable name in the
table expression. You can apply a summary specification to multiple
variables by enclosing the variables in parentheses. The following
specifications are equivalent:
/TABLE SEX [COUNT] + HAPPY [COUNT, COLPCT] /TABLE (SEX + HAPPY [COLPCT])[COUNT]
- The brackets are required even if only one summary is specified.
- Commas are optional.
- Label and format are both optional; defaults are used if label and format are not specified.
- If totals or subtotals are defined for a variable (on the CATEGORIES subcommand), by default, the same functions that are specified for the variable are used for the totals. You can use the keyword TOTALS within the summary specification to specify different summary functions for the totals and subtotals. The specification then has the form [summary ‘label’ format ... TOTALS [summary ‘label’ format...]]. You must still specify TOTAL=YES on the CATEGORIES subcommand to see the totals.
- Summaries that are available for category variables are also available for scale variables and multiple response sets. Functions that are specific to scale variables and to multiple response sets are also available.
- If case weighting is in effect, summaries are calculated taking into account the current WEIGHT value. To obtain unweighted summaries, prefix a U to the function name, as in UCOUNT. Unweighted functions are not available where weighting would not apply, as in the MINIMUM and MAXIMUM functions.
Example
CTABLES /TABLE SEX > HAPMAR [COLPCT] BY CHILDCAT.
Example
CTABLES /TABLE AGECAT > TVHOURS [MEAN F5.2,
STDDEV 'Standard Deviation' F5.2, PTILE 90 '90th Percentile'].
- Each summary function for the row variable appears by default in a column.
- Labels for standard deviation and the 90th percentile override the defaults.
- Because TVHOURS is recorded in whole hours and has an integer print format, the default general print formats for mean and standard deviation would also be integer, so overrides are specified.
Function | Description | Default Label* | Default Format |
---|---|---|---|
COUNT | Number of cases in each category. This is the default for categorical and multiple response variables. | Count | Count |
ROWPCT.COUNT | Row percentage based on cell counts. Computed within subtable. | Row % | Percent |
COLPCT.COUNT | Column percentage based on cell counts. Computed within subtable. | Column % | Percent |
TABLEPCT.COUNT | Table percentage based on cell counts. | Table % | Percent |
SUBTABLEPCT.COUNT | Subtable percentage based on cell counts. | Subtable % | Percent |
LAYERPCT.COUNT | Layer percentage based on cell counts. Same as table percentage if no layers are defined. | Layer % | Percent |
LAYERROWPCT.COUNT | Row percentage based on cell counts. Percentages sum to 100% across the entire row (that is, across subtables). | Layer Row % | Percent |
LAYERCOLPCT.COUNT | Column percentage based on cell counts. Percentages sum to 100% across the entire column (that is, across subtables). | Layer Column % | Percent |
ROWPCT.VALIDN | Row percentage based on valid count. | Row Valid N % | Percent |
COLPCT.VALIDN | Column percentage based on valid count. | Column Valid N % | Percent |
TABLEPCT.VALIDN | Table percentage based on valid count. | Table Valid N % | Percent |
SUBTABLEPCT.VALIDN | Subtable percentage based on valid count. | Subtable Valid N % | Percent |
LAYERPCT.VALIDN | Layer percentage based on valid count. | Layer Valid N % | Percent |
LAYERROWPCT.VALIDN | Row percentage based on valid count. Percentages sum to 100% across the entire row. | Layer Row Valid N % | Percent |
LAYERCOLPCT.VALIDN | Column percentage based on valid count. Percentages sum to 100% across the entire column. | Layer Column Valid N % | Percent |
ROWPCT.TOTALN | Row percentage based on total count, including user-missing and system-missing values. | Row Total N % | Percent |
COLPCT.TOTALN | Column percentage based on total count, including user-missing and system-missing values. | Column Total N % | Percent |
TABLEPCT.TOTALN | Table percentage based on total count, including user-missing and system-missing values. | Table Total N % | Percent |
SUBTABLEPCT.TOTALN | Subtable percentage based on total count, including user-missing and system-missing values. | Subtable Total N % | Percent |
LAYERPCT.TOTALN | Layer percentage based on total count, including user-missing and system-missing values. | Layer Total N % | Percent |
LAYERROWPCT.TOTALN | Row percentage based on total count, including user-missing and system-missing values. Percentages sum to 100% across the entire row. | Layer Row Total N % | Percent |
LAYERCOLPCT.TOTALN | Column percentage based on total count, including user-missing and system-missing values. Percentages sum to 100% across the entire column. | Layer Column Total N % | Percent |
* This is the default on a U.S.-English system.
The .COUNT suffix can be omitted from percentages that are based on cell counts. Thus, ROWPCT is equivalent to ROWPCT.COUNT.
Function | Description | Default Label | Default Format |
---|---|---|---|
MAXIMUM | Largest value. | Maximum | General |
MEAN | Arithmetic mean. The default for scale variables. | Mean | General |
MEDIAN | 50th percentile. | Median | General |
MINIMUM | Smallest value. | Minimum | General |
MISSING | Count of missing values (both user-missing and system-missing). | Missing | General |
MODE | Most frequent value. If there is a tie, the smallest value is shown. | Mode | General |
PTILE | Percentile. Takes a numeric value between 0 and 100 as a required parameter. PTILE is computed the same way as APTILE in the TABLES command. Note that in the TABLES command, the default percentile method was HPTILE. | Percentile ####.## | General |
RANGE | Difference between maximum and minimum values. | Range | General |
SEMEAN | Standard error of the mean. | Std Error of Mean | General |
STDDEV | Standard deviation. | Std Deviation | General |
SUM | Sum of values. | Sum | General |
TOTALN | Count of nonmissing, user-missing, and system-missing values. The count excludes valid values hidden via the CATEGORIES subcommand. | Total N | Count |
VALIDN | Count of nonmissing values. | Valid N | Count |
VARIANCE | Variance. | Variance | General |
ROWPCT.SUM | Row percentage based on sums. | Row Sum % | Percent |
COLPCT.SUM | Column percentage based on sums. | Column Sum % | Percent |
TABLEPCT.SUM | Table percentage based on sums. | Table Sum % | Percent |
SUBTABLEPCT.SUM | Subtable percentage based on sums. | Subtable Sum % | Percent |
LAYERPCT.SUM | Layer percentage based on sums. | Layer Sum % | Percent |
LAYERROWPCT.SUM | Row percentage based on sums. Percentages sum to 100% across the entire row. | Layer Row Sum % | Percent |
LAYERCOLPCT.SUM | Column percentage based on sums. Percentages sum to 100% across the entire column. | Layer Column Sum % | Percent |
Function | Description | Default Label | Default Format |
---|---|---|---|
RESPONSES | Count of responses. | Responses | Count |
ROWPCT.RESPONSES | Row percentage based on responses. Total number of responses is the denominator. | Row Responses % | Percent |
COLPCT.RESPONSES | Column percentage based on responses. Total number of responses is the denominator. | Column Responses % | Percent |
TABLEPCT.RESPONSES | Table percentage based on responses. Total number of responses is the denominator. | Table Responses % | Percent |
SUBTABLEPCT.RESPONSES | Subtable percentage based on responses. Total number of responses is the denominator. | Subtable Responses % | Percent |
LAYERPCT.RESPONSES | Layer percentage based on responses. Total number of responses is the denominator. | Layer Responses % | Percent |
LAYERROWPCT.RESPONSES | Row percentage based on responses. Total number of responses is the denominator. Percentages sum to 100% across the entire row (that is, across subtables). | Layer Row Responses % | Percent |
LAYERCOLPCT.RESPONSES | Column percentage based on responses. Total number of responses is the denominator. Percentages sum to 100% across the entire column (that is, across subtables). | Layer Column Responses % | Percent |
ROWPCT.RESPONSES.COUNT | Row percentage: Responses are the numerator, and total count is the denominator. | Row Responses % (Base: Count) | Percent |
COLPCT.RESPONSES.COUNT | Column percentage: Responses are the numerator, and total count is the denominator. | Column Responses % (Base: Count) | Percent |
TABLEPCT.RESPONSES.COUNT | Table percentage: Responses are the numerator, and total count is the denominator. | Table Responses % (Base: Count) | Percent |
SUBTABLEPCT.RESPONSES.COUNT | Subtable percentage: Responses are the numerator, and total count is the denominator. | Subtable Responses % (Base: Count) | Percent |
LAYERPCT.RESPONSES.COUNT | Layer percentage: Responses are the numerator, and total count is the denominator. | Layer Responses % (Base: Count) | Percent |
LAYERROWPCT.RESPONSES.COUNT | Row percentage: Responses are the numerator, and total count is the denominator. Percentages sum to 100% across the entire row (that is, across subtables). | Layer Row Responses % (Base: Count) | Percent |
LAYERCOLPCT.RESPONSES.COUNT | Column percentage: Responses are the numerator, and total count is the denominator. Percentages sum to 100% across the entire column (that is, across subtables). | Layer Column Responses % (Base: Count) | Percent |
ROWPCT.COUNT.RESPONSES | Row percentage: Count is the numerator, and total responses are the denominator. | Row Count % (Base: Responses) | Percent |
COLPCT.COUNT.RESPONSES | Column percentage: Count is the numerator, and total responses are the denominator. | Column Count % (Base: Responses) | Percent |
TABLEPCT.COUNT.RESPONSES | Table percentage: Count is the numerator, and total responses are the denominator. | Table Count % (Base: Responses) | Percent |
SUBTABLEPCT.COUNT. RESPONSES | Subtable percentage: Count is the numerator, and total responses are the denominator. | Subtable Count % (Base: Responses) | Percent |
LAYERPCT.COUNT. RESPONSES | Layer percentage: Count is the numerator, and total responses are the denominator. | Layer Count % (Base: Responses) | Percent |
LAYERROWPCT.COUNT.RESPONSES | Row percentage: Count is the numerator, and total responses are the denominator. Percentages sum to 100% across the entire row (that is, across subtables). | Layer Row Count % (Base: Responses) | Percent |
LAYERCOLPCT.COUNT.RESPONSES | Row percentage: Count is the numerator, and total responses are the denominator. Percentages sum to 100% across the entire column (that is, across subtables). | Layer Column Count % (Base: Responses) | Percent |