Designates a group of statements to be executed as a unit
| Valid: |
in a DATA step
|
| Category: |
Control
|
| Type: |
Executable
|
DO;
...more SAS statements...
|
Use the DO
statement for simple DO group processing.
The DO statement is the simplest form of DO group processing.
The statements between the DO and END statements are called a DO group. You can nest DO statements within DO groups.
Note:
The memory capabilities of your system may
limit the number of nested DO statements
you can use. For details, see the SAS documentation about how many levels
of nested DO statements your system's memory can support.
A simple DO statement is often used within IF-THEN/ELSE
statements to designate a group of statements to be executed depending on
whether the IF condition is true or false.
There are three other forms of the DO statement:
In this simple DO group, the statements between DO and
END are performed only when YEARS is greater than 5. If YEARS is less than
or equal to 5, statements in the DO group do not execute, and the program
continues with the assignment statement that follows the ELSE statement.
if years>5 then
do;
months=years*12;
put years= months=;
end;
else yrsleft=5-years;
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.