Throughout GTL documentation,
you see
expression used in
statement documentation:
BOXPLOT X= column | expressionY= numeric-column | expression < /option(s)>;
For the X= argument,
expression means any EVAL(
expression) that results in either a numeric
or character column. An expression that yields a constant is not valid
because the X= argument does not accept constants.
Similarly, for the Y=
argument, expression means any EVAL(
expression) that results in a numeric column. The expression cannot result
in a character column or any constant because the Y= argument only
accepts a numeric column.
On the following REFERENCELINE
statement, the X= argument can be a constant (single line) or a column
(multiple lines) that has the same data type as the axis. This means
that EVAL(
expression) can result
in a numeric or character column or constant that agrees with the
axis type.
REFERENCELINE X= x-axis-value | column | expression </option(s)>;
Automatic Type
Conversion. Although expressions that are used in a DATA
step perform automatic type conversion, GTL expression evaluation
does not. Thus, you must use function(s) to perform required type
conversions in an expression. Otherwise, the expression generates
an error condition without warning when the template is executed.
For example, consider
the following GTL expression:
if(substr(value, 1, 2) = "11")
This expression uses
the SUBSTR function to determine whether the first two characters
from VALUE evaluate to the string value "11". If VALUE is a string,
the expression works fine. However, if VALUE is numeric, the expression
generates an error condition. For a numeric, you must convert the
value to a string before passing it to the SUBSTR function. The following
modification uses the CATS function to perform the type conversion
when necessary:
if(substr(cats(value, 1, 2)) = "11")