Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

<variable> = <variable> + 0

 

Conditional Processing

If <argument>; restricts data set to the condition

 

Use else if for mutually exclusive statements (more efficient). Only 1 executable statement is allowed per IF-THEN statement; to perform multiple arguments then use IF-DO statement:

If <argument> then do; argument 1; Argument 2; argument 3 …; end;

If …. then do; arguments…..; end;

Else do….; end; run;


Inclusive range for IF statement can be achieved with: 5 le <variable> le 7; gives observations between 5-7 inclusive

   

Numerical operators

 

Mean

Arithmetic   mean

Sum

Sum or   arguments

Var

Variance

Sin

Sine

Log

Natural   log

SQRT

Square   root

ABS

Absolute   value

 

Logical  operators

Modify where expressions: not / and / or

Eg where city not in('London','Rome','Paris') = city is not London, Rome or Paris

 

Comparison operators

 

Equal to

eq

=

Not equal   to

ne

 

Less than

lt

<

Greater   than or equal

ge

>=

Less than   or equal

le

<=

Equal to   one of a list

in

 

 

Special where operators (can only be used for where statements)

 

Operator

Definition

Char

num

Contains

Includes   substring

x

 

Between   and

Inclusive   range

x

x

Is null

A missing   value

x

x

Is   missing

A missing   value

x

x

Like

Matches a   pattern

x

 

Where   same and

Augments   original condition

x

x