Rabidwolff's Alehouse
"Your place for fun and knowledge."
HOME | Quotes | SAS | C# | BEER



Basics
FORMATS
INFORMATS
DATETIME
ATTRIB
LENGTH
FORMAT
INFORMAT
LABEL
JOINS
OPERATORS

Statements
RETAIN
FIRST.
LAST.

Procedures
PROC SORT
PROC COPY
PROC CPORT
IF ELSE
PROC REPORT

Functions
CAT
CATS
CATT
CATX

CDISC
Random Q & A

CDISC
CDISC Info

Coded Tools
XML Output
Examples

SAS Operators

Arithmetic Operators

Operator Priority Purpose Example
- I Negative Prefix X_Negative= -X;
** I Exponent X_Squared= X**2;
* II Multiply X_Times2= X*2;
/ II Divide X_DivideBy2= X/2;
+ III Add X_Plus2= X+2;
- III Substract X_Minus2= X-2;

Order that an Expression is Solved:
  1. Parentheses are completed first starting with the inner most
  2. Higher priority operators are completed first (I is the highest)
  3. Priority I operators are completed right to left
  4. Priority II and III operators are completed left to right

Comparison Operators

Operator Purpose Example
= or eq Equal To x = 7 or x eq 7
^= or ne Not Equal To x ^= 7 or x ne 7
> or gt Greater Than x > 7 or x gt 7
< or lt Less Than x < 7 or x lt 7
< or lt Less Than x < 7 or x lt 7
>= or ge Greater Than or Equal To x >= 7 or x ge 7
<= or le Less Than or Equal To x <= 7 or x le 7

Logical Operators

Operator Purpose Example
AND or & Returns true only if both the left and right boolean expresion are true x = 7 and y eq 7
OR or | Returns true if either or both left and right boolean expressions are true x = 7 or y eq 7

Rabidwolff Industries | Establisted: 10/15/2011 | Version: 4 8/4/2012 | Page Last Generatated: 9/25/2021 4:32:32 PM