IF condition variable=expression.
IF condition vector(index)=expression.
IF transformation conditionally assigns the value of a target
expression to a target variable, based on the truth of a test
Specify a boolean-valued expression (see Mathematical Expressions) to be tested
IF keyword. This expression is evaluated for each case.
If the value is true, then the value of the expression is computed and
assigned to the specified variable. If the value is false or missing,
nothing is done. Numeric and string variables may be
assigned. When a string expression’s width differs from the target
variable’s width, the string result of the expression is truncated or
padded with spaces on the right as necessary. The expression and
variable types must match.
The target variable may be specified as an element of a vector (see VECTOR). In this case, a vector index expression must be specified in parentheses following the vector name. The index expression must evaluate to a numeric value that, after rounding down to the nearest integer, is a valid index for the named vector.
IF to assign to a variable specified on
(see LEAVE) resets the variable’s left state. Therefore,
LEAVE should be specified following
IF, not before.