TEMPLATE Procedure: Creating Table Templates

TRANSLATE INTO Statement

Translates the specified numeric values to other values.
Restrictions: The TRANSLATE INTO statement can be used only in a table template or a column template.

The TRANSLATE INTO statement in a table template applies only to numeric variables. To translate the values of a character variable, use TRANSLATE INTO in the template of that column.

See: Setting the Style Element for Cells Based on Their Values

Syntax

Required Arguments

expression-1
is an expression that is evaluated for each table or column cell that contains a numeric variable.
If expression-1 resolves to TRUE (a nonzero value), the translation that is specified is used for the current cell. If expression-1 is FALSE (zero), the next expression in the statement is evaluated. Thus, you can string multiple expressions together to format cells conditionally.
expression has this form:
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 the name of a column or symbols that are declared in a DYNAMIC, MVAR, or NMVAR statement in the current template.
SAS function
specifies a SAS function. For information about SAS functions, see SAS Functions and CALL Routines: Reference.
built-in variable
is a special type of WHERE expression operand that helps you find common values in table or column templates. Built-in variables are one or more of the following:
_COLUMN_
is a column number. Column numbering begins with 1.
_DATANAME_
is a data column name.
_DATATYPE_
is the data type of the column variable. The data type is either numeric ("num") or character ("char").
_LABEL_
is a column label.
_ROW_
is a row number. Row numbering begins with 1.
_STYLE_
is a style element name.
_VAL_
is the data value of a cell.
Tip:Use _VAL_ to represent the value of the current column.
comparison-operator
compares a variable with a value or with another variable. The following table lists the comparison operators:
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
Restriction:You cannot reference the values of other columns in expression-1.
Tip:Using an expression of 1 as the last expression in the TRANSLATE–INTO statement specifies a translation for any cells that did not meet an earlier condition.
See:You can use any expression that can be used in the WHERE= data set option. For information about expressions that you can use in the WHERE data set option, see the WHERE data set option in SAS Data Set Options: Reference and the section on WHERE-Expression Processing in SAS Language Reference: Concepts.
expression-2
is an expression that specifies the value to use in the cell in place of the variable's actual value.
expression has this form:
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 the name of a column or symbols that are declared in a DYNAMIC, MVAR, or NMVAR statement in the current template.
SAS function
specifies a SAS function. For information about SAS functions, see SAS Functions and CALL Routines: Reference.
Built-in variable
a special type of WHERE expression operand that helps you find common values in table templates. Built-in variables are one or more of the following:
_COLUMN_
is a column number. Column numbering begins with 1.
_DATANAME_
is a data column name.
_DATATYPE_
is the data type of the column variable. The data type is either numeric ("num") or character ("char").
_LABEL_
is a column label
_ROW_
is a row number. Row numbering begins with 1.
_STYLE_
is a style element name.
See:For a table of style element names, see ODS Style Elements.
_VAL_
is the data value of a cell.
Tip:Use _VAL_ to represent the value of the current column.
comparison-operator
compares a variable with a value or with another variable. The following table lists the comparison operators:
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
Restriction:expression-2 must resolve to a character value, not a numeric value.
Tip:When you translate a numeric value to a character value, the table template or column template does not try to apply the numeric format that is associated with the column. Instead, it simply writes the character value into the formatted field, starting at the left. To right-justify the value, use the JUSTIFY=ON attribute.
See:JUSTIFY<=ON | OFF | variable>; column attribute

You can use any expression that can be used in the WHERE= data set option. For information about expressions that you can use in the WHERE data set option, see the WHERE data set option in SAS Data Set Options: Reference and the section on WHERE-Expression Processing in SAS Language Reference: Concepts.