| SAS operators are symbols that request a comparison,
a logical operation, an arithmetic
calculation, or a concatenation.
A SAS expression with no more than one operator is called a simple expression. When an expression includes several operators, it is called a compound expression. When SAS encounters a compound expression, it follows certain rules to determine the order in which to evaluate each part of the expression. See "SAS Expressions" in SAS Language Reference: Concepts for a complete discussion of the rules for evaluating compound expressions. The following table lists all SAS operators. |
| Symbols | Mnemonic Equivalent | Definition | Example |
|---|---|---|---|
| ** | exponentiation | y=a**2; |
|
| + | positive prefix | y=+(a+b); |
|
| - | negative prefix | z=-(a+b); |
|
| ¬ | NOT | logical not | if not z then put x; |
| >< | MIN | minimum | x=(a><b); |
| <> | MAX | maximum | x=(a<>b); |
| * | multiplication | c=a*b; |
|
| / | division | f=g/h; |
|
| + | addition | c=a+b; |
|
| - | subtraction | f=g-h; |
|
| || !! ¦¦ | concatenate character values | name= 'J'||'SMITH'; |
|
| < | LT | less than | if x<y then c=5; |
| <= | LE | less than or equal to | if x le y then a=0; |
| = | EQ | equal to | if y eq (x+a) then output; |
| ¬= | NE | not equal to | if x ne z then output; |
| >= | GE | greater than or equal to | if y>=a then output; |
| > | GT | greater than | if z>a then output; |
| IN | equal to one of a list | if state in
('NY','NJ','PA')
then region='NE';
|
|
| & | AND | logical and | if a=b & c=d then x=1; |
| | ! ¦ | OR | logical or | if y=2 or x=3 then a=d; |
Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.