An expression is a sequence of operands and operators which form a set
of instructions that are performed to produce a result value.
Operands are variable names or constants. They can be numeric,
character or both. Operators are special-character operators,
functions, or grouping parentheses.
Use expressions in SAS programming statements to
|
Arithmetic operators indicate that a calculation is performed. The table below lists the arithmetic operators. |
Symbol | Meaning | Example |
---|---|---|
** |
exponentiation | A**3 |
* |
multiplication | 12*salary |
/ |
division | income/grosspay |
+ |
addition | score1+score2 |
- |
subtraction | total-cost |
The following comparison operators are used to express a condition. |
Symbol | Meaning | Example |
---|---|---|
= or eq |
equal to | name='Jones, C.' |
^= or ne |
not equal to | temp ne 212 |
> or gt |
greater than | income>20000 |
< or lt |
less than | partno lt "BG05" |
>= or ge |
greater than or equal to | id>='1543' |
<= or le |
less than or equal to | pulse le 85 |
To link a sequence of expressions into compound expressions, you use logical operators, including the following: |
Operator | Meaning |
---|---|
AND ( & ) | and, both. If both expressions are true, then the compound expression is true. |
OR ( | ) | or, either. If either expression is true, then the compound expression is true. |
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.