TEMPLATE Procedure: Creating Crosstabulation Table Templates

TEXT Statement

Specifies the text of the header or the footer.
Restriction: TheTEXT statement can be used only with the DEFINE HEADER or DEFINE FOOTER statements.
Creating a Customized Crosstabulation Table Template with No Legend

Syntax

Required Argument

header-specification(s)
specifies the text of the header. header-specification(s) can be any dynamic variable that is specified by the DYNAMIC statement, or it can be one of the following:
dynamic-variable
is a variable that is automatically defined by SAS in the crosstabulation template. dynamic-variable can be one of the following:
_COL_LABEL_
is the label of the column variable, which is the last variable in a table request.
_COL_NAME_
is the name of the column variable, which is the last variable in a table request. If the column variable does not have a name, then the value of _COL_LABEL_ is an empty text string (“ ”).
_ROW_LABEL_
is the label of the row variable, which is the next to the last variable in a table request. If the row variable does not have a label, the value of _ROW_LABEL_ is an empty text string (“ ”).
_ROW_NAME_
is the name of the row variable, which is the next to the last variable in a table request.
text-specification(s)
specifies the text to use in the header. Each text-specification is one of the following:
  • a quoted string.
  • a variable followed by an optional format. The variable is any variable that is declared in a DYNAMIC statement or is any of the variables above.
Tip:If the quoted string is a blank and it is the only item in the header specification, the header is a blank line.

Optional Argument

expression
is an expression that is evaluated for a header or footer. If expression is omitted, the default is 1. Each DEFINE HEADER statement can contain any number of TEXT statements. The template evaluates each expression in turn from top to bottom and thereby determines the text of the header. The header-specification in the first TEXT statement whose expression evaluates to true becomes the header text. After an expression evaluates to true, the template examines no more TEXT statements. If no expression is true, then the header is not used.
expression-1 <comparison-operator expression-n>
expression
is an arithmetic or logical expression that consists of a sequence of operators and operands. An operator is a symbol that requests a comparison, logical operation, or arithmetic calculation. An operand is one of the following:
constant
is a fixed value, such as a number or text string.
dynamic variable
is a variable that is defined by SAS in the crosstabulation template or by the DYNAMIC statement within a header or footer template.
_COL_LABEL_
specifies the label of the column variable, which is the last variable in a table request. If the column variable does not have a label, then the value of _COL_LABEL_ is an empty text string (“ ”).
_COL_NAME_
specifies the name of the column variable, which is the last variable in a table request. If the column variable does not have a name, then the value of _COL_NAME_ is an empty text string (“ ”).
FMISSING
is the number of missing values in the table.
Requirement:The FMISSING dynamic variable must be specified by the DYNAMIC statement before you can use it in an expression.
NOTITLE
is set to 1 if PROC FREQ's NOTITLE option was used, and it is set to 0 if the NOTITLE option was not used.
Requirement:The NOTITLE dynamic variable must be specified by the DYNAMIC statement before you can use it in an expression.
_ROW_LABEL_
is the label of the row variable, which is the next to the last variable in a table request. If the row variable does not have a name, then the value of _ROW_LABEL_ is an empty text string (“ ”).
_ROW_NAME_
specifies the name of the row variable, which is the next to the last variable in a table request. If the row variable does not have a name, then the value of _ROW_NAME_ is an empty text string (“ ”).
SAMPLESIZE
is set to 0 if the table is empty. Otherwise, it is set to 1.
Requirement:The SAMPLESIZE dynamic variable must be specified by the DYNAMIC statement before you can use it in an expression.
STRATNUM
is the current stratum number if the table has multiple strata. If the table has only one stratum, then the value is 0.
Requirement:The STRATNUM dynamic variable must be specified by the DYNAMIC statement before you can use it in an expression.
STRATAVARIABLENAMES
is a string that identifies the current stratum by the name of the stratum variables.
var-1=value-1<var-n=value-n>
var-1var-n
specifies the stratum variables.
value-1–value-n
specifies the values of the stratum variables.
Tip:The value is undefined when the table has only one stratum.
Requirement:The STRATAVARIABLENAMES dynamic variable must be specified by the DYNAMIC statement before you can use it in an expression.
STRATAVARIABLELABELS
is a string that identifies the current stratum by the label of the stratum variables. STRATAVARIABLELABELS has the following form:
var-1=value-1<var-n=value-n?>
var-1var-n
specifies the stratum variables.
value-1value-n
specifies the values of the stratum variables.
Tip:The value is undefined when the table has only one stratum.
Requirement:The DYNAMIC statement must specify the STRATAVARIABLELABELS dynamic variables before you can use them in an expression.
comparison-operator
compares a variable with a value or another variable.
Comparison Operators
Symbol
Mnemonic Equivalent
Definition
=
EQ
Equal to
^= or ~= or ¬= or <>
NE
Not equal to
>
GT
Greater than
<
LT
Less than
>=
GE
Greater than or equal to
<=
LE
Less than or equal to
IN
Equal to one from a list of values