Chapter Contents |
Previous |
Next |
DO |
Valid: | in a DATA step |
Category: | Control |
Type: | Executable |
Syntax | |
Without Arguments | |
Details | |
Comparisons | |
Examples | |
See Also |
Syntax |
DO;
...more SAS statements... |
END; |
Use the DO statement for simple DO group processing.
Details |
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.
Comparisons |
There are three other forms of the DO statement:
Examples |
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;
See Also |
Statements:
|
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.