SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Generating Data with DO Loops
Conditionally Executing DO Loops


Using the DO WHILE Statement

You can use the DO WHILE statement to execute a DO loop while a condition is true.


General form, DO WHILE statement:
DO WHILE(expression);
more SAS statements
END;

where expression is a valid SAS expression enclosed in parentheses.


The statements execute while the expression is true. An important difference between the DO UNTIL and DO WHILE statements is that the DO WHILE expression is evaluated at the top of the DO loop. If the expression is false the first time it is evaluated, the DO loop never executes.



back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement