TEMPLATE Procedure: Creating Crosstabulation Table Templates

DEFINE CELLVALUE Statement

Defines a value that appears in the crosstabulation cells.
Note: The DEFINE CELLVALUE statement begins a DEFINE CELLVALUE block. The following statements are commonly used within the block: CELLSTYLE AS Statement, DYNAMIC Statement, NOTES Statement, and END Statement.
Creating a Customized Crosstabulation Table Template with No Legend

Syntax

DEFINE CELLVALUE <cellvalue>;
CELLSTYLE expression-1 AS <style-element-name><[style-attribute-specification(s)] >
<, expression-n AS <style-element-name><[style-attribute-specification(s)]>>;
DYNAMIC variable-1<'text-1'> < variable-n<'text-n'>>;
NOTES 'text';
END;

Optional Argument

cellvalue
specifies one of the possible values that PROC FREQ can produce for a crosstabulation table. For a cellvalue to appear in a cell, it must meet one of these requirements:
  • specified in a DEFINE CELLVALUE statement
  • included in the CELLVALUE statement
  • not suppressed by one of the following options for the TABLES statement in PROC FREQ: NOFREQ, NOPERCENT, NOROW, NOCOL, or CUMCOL
  • requested by one of the following options: EXPECTED, DEVIATION, CELLCHI2, or TOTPCT
To prevent a cellvalue from appearing in a table, you need to change only one of the preceding specifications.
cellvalue is one of the following:
Frequency
is the frequency count.
Expected
is the expected frequency of the cell.
Deviation
is the deviation of the cell frequency from the expected value.
CellChiSquare
is the cell's contribution to the total Pearson chi-square statistic.
TotalPercent
is the percentage of total frequency on n-way tables when n>2.
Percent
is the percentage of the table frequency.
RowPercent
is the percentage of the row frequency.
ColPercent
is the percentage of the column frequency.
CumColPercent
is the cumulative percentage of the column frequency.

DEFINE CELLVALUE Attribute Statements

This section lists all the attribute statements that you can use in a cellvalue template and the tasks that are associated with the statements. For all attributes that support a value of ON, these forms are equivalent: ATTRIBUTE-NAME and ATTRIBUTE-NAME=ON.
DEFINE CELLVALUE Attribute Statements
Task
Statement
Specify which format to use for the cellvalue if both a crosstabulation template and a data component specify a format
DATA_FORMAT_OVERRIDE=ON | OFF;
Specify the format for the cellvalue
FORMAT=format_name <format-width<decimal-width >>;
Override the width specified by the FORMAT= attribute
FORMAT_WIDTH=positive-integer
Override the number of decimals specified by the FORMAT= attribute
FORMAT_NDEC=positive-integer
Specify the text in the legend
HEADER='text'
For the Output destination, specify the label for the data set column corresponding to the cellvalue
LABEL='text'
Specify whether a cellvalue appears in the crosstabulation table
PRINT= ON | OFF
DATA_FORMAT_OVERRIDE=<ON | OFF>;
specifies which format to use if both a crosstabulation template and a data component specify a format for Frequency, Expected, and Deviation.
ON
selects the format specified in the data component.
OFF
selects the format specified in the crosstabulation template.
Default:OFF
Interaction:If you specify DATA_FORMAT_OVERRIDE=ON, and the FORMAT option is specified in the TABLES statement in PROC FREQ, then the data component will specify that format for the Frequency, Expected, and Deviation cellvalues.
FORMAT=format_name <format-width<decimal-width >>;
specifies the format for the column.
Default:If you omit the FORMAT= option, PROC TEMPLATE uses the format that the data component provides. If the data component does not provide a format, PROC TEMPLATE uses one of the following: BEST8. for integers, 12.3 for floating-point values, or the length of the variable for character variables.
Range:The minimum cell width is 8, and the maximum width is 25.
Interaction:For LISTING output, the width of the cells is governed by the format width. Cells are at least one character wider than the format width.
FORMAT_WIDTH=positive-integer
overrides the width specified by the FORMAT= attribute statement.
FORMAT_NDEC=positive-integer
overrides the number of decimals specified by the FORMAT= attribute statement.
HEADER='text'
specifies the text in the legend.
Tip:For LISTING output, only the first 15 characters of text are displayed.
LABEL='text'
for the OUTPUT destination, specifies the label for the data set column that corresponds to the cellvalue.
PRINT= ON | OFF
specifies whether the cellvalue appears in the crosstabulation table.
Both this attribute and the TABLES statement option for the cellvalue control the presence of the cellvalue in the table. For example, the expected cell frequency is present only when the EXPECTED option is used and the Expected cellvalue template has PRINT=ON specified.