The OPTMODEL Procedure

DO WHILE Statement

DO WHILE ( logic-expression ) ; statement(s) ; END;

The DO WHILE loop executes the specified sequence of statements repeatedly as long as the logic-expression, evaluated before the statements , returns true (a nonmissing nonzero value).

For example, the following code outputs the values 1 and 2:

  
    proc optmodel; 
       number i; 
       i = 1; 
       do while (i<3); 
          put i; 
          i=i+1; 
       end;
 

Note that multiple criteria can be introduced using expression operators, as in the following example:

  
    do while (i<3 and j<7);
 

For a list of expression operators, see Table 6.3.

Previous Page | Next Page | Top of Page