DO Statement with an UNTIL Clause
conditionally executes statements iteratively
- DO UNTIL( expression);
- DO variable=start TO stop
<BY increment>
UNTIL(expression);
The inputs to the DO UNTIL statement are as follows:
- expression
- is an expression that is evaluated at the
bottom of the loop for being true or false.
- variable
- is the name of a variable indexing the loop.
- start
- is the starting value for the looping variable.
- stop
- is the stopping value for the looping variable.
- increment
- is an increment value.
Using an UNTIL expression makes possible the conditional
execution of a set of statements iteratively.
The UNTIL expression is evaluated at the bottom of the loop,
and the statements inside the loop are executed repeatedly
as long as the expression yields a zero or missing value.
In the example that follows, the body of the
loop executes until the value of X exceeds 100:
x=1;
do until (x>100);
x=x+1;
end;
print x; /* x=101 */
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.