TEMPLATE Procedure: Creating Table Templates
COMPUTE AS Statement
Computes values for a column that is not in the
data component, or modifies the values of a column that is in the
data component.
Restriction: 
The COMPUTE AS statement can be used only within a column
template.

Syntax
Required Argument
 expression

is an expression that
assigns a value to each table cell in the column.
expression has
this form:
expression1 <comparisonoperator expressionn>
 expression

is an arithmetic or
logical sequence of operators and operands. An operator is a symbol
that requests a comparison, a logical operation, or an 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.
To reference another
column in a COMPUTE AS statement, use the name of the column. In addition,
if the column has values in the data component, you can reference
the column itself in the expression.
For example, this DEFINE
COLUMN block defines a column that contains the square root of the
value in the column called Source:
define column sqroot;
compute as sqrt(source);
header="Square Root";
format=6.4;
end;
 function

specifies a SAS function.
For information about SAS functions, see SAS Functions and CALL Routines: Reference.
 builtin variable

is a special type of
WHERE expression operand that helps you find common values in column
templates. Builtin variables are one or more of the following:
 _COLUMN_

is a column number.
Column numbering begins with 1.
 _DATANAME_

is a datacolumn name.
 _LABEL_

is a column label.
 _ROW_

is a row number. Row
numbering begins with 1.
 _STYLE_

is a styleelement
name.
 _VAL_

is the data value of
a cell.
Tip:Use _VAL_ to represent the value of the current column.
 comparisonoperator

compares a variable
with a value or another variable.
Comparison Operators























Equal to one from a
list of values

Tip:The COMPUTE AS statement can alter values in an output
object. None of the templates that SAS provides modifies any values.
To determine whether a template was provided by SAS, use the
ODS VERIFY Statement. If the template is not from SAS, the ODS VERIFY statement
returns a warning when it runs the SAS program that uses the template.
If you receive such a warning, use the SOURCE statement to look at
the template and determine whether the COMPUTE AS statement alters
values. (See
SOURCE Statement.)
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 WHEREExpression Processing in SAS Language Reference: Concepts.
Copyright © SAS Institute Inc. All rights reserved.