IF

IF [(]logical expression[)] target variable=expression

This command does not read the active dataset. It is stored, pending execution with the next command that reads the dataset. See the topic Command Order for more information.

The following relational operators can be used in logical expressions:

Table 1. Relational operators
Symbol Definition
EQ or = Equal to
NE or ~= or ¬ = or <> Not equal to
LT or < Less than
LE or <= Less than or equal to
GT or > Greater than
GE or >= Greater than or equal to

The following logical operators can be used in logical expressions:

Table 2. Logical operators
Symbol Definition
AND or & Both relations must be true
OR or | Either relation can be true
NOT Reverses the outcome of an expression

Example

IF (AGE > 20 AND SEX = 1) GROUP=2.