Previous PageNext Page

SUM Statement and Implicit Retain
The above example program may be made easy by using a SUM statement.

Data NumVisit;

The SUM Statement.

variable+expression;

Here is another case of a SAS statement with no keyname. How does the compiler know this is a sum statement and not a common numerical operation? The required syntax includes a "+" with no "=".
There is an implicit RETAIN statement that initializes the variable in the SUM statement to zero.

Note: If you want to reduce the value of a variable, you may not use "VARNAME - 1;". The "+" must appear. Instead, use "VARNAME + (-1);".

Previous PageTable Of ContentsNext Page