Chapter Contents

Previous

Next
DO UNTIL

DO UNTIL



Executes statements in a DO loop repetitively until a condition is true

Valid: in a DATA step
Category: Control
Type: Executable


Syntax
Arguments
Details
Comparisons
Examples
See Also

Syntax

DO UNTIL (expression);
...more SAS statements...
END;

Arguments

(expression)
is any SAS expression, enclosed in parentheses. You must specify at least one expression.


Details

The expression is evaluated at the bottom of the loop after the statements in the DO loop have been executed. If the expression is true, the DO loop does not iterate again.

Note:   The DO loop always iterates at least once.  [cautionend]


Comparisons

There are three other forms of the DO statement:


Examples

These statements repeat the loop until N is greater than or equal to 5. The expression N>=5 is evaluated at the bottom of the loop. There are five iterations in all (0, 1, 2, 3, 4).

n=0;
   do until(n>=5);
      put n=;
      n+1;
   end;

See Also

Statements:

DO
DO, Iterative
DO WHILE


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.