Programming Statements

Iteration Statements

The DO statement supports clauses that iterate over compound statements. With an iterative DO statement, you can repeatedly execute a set of statements until some condition stops the execution. The following table lists the different kinds of iteration statements in the SAS/IML language:

Clause DO Statement
DATA DO DATA statement
variable = start TO stop < BY increment > Iterative DO statement
WHILE(expression) DO WHILE statement
UNTIL(expression) DO UNTIL statement

A DO statement can have any combination of these four iteration clauses, but the clauses must be specified in the order listed in the preceding table.

Last updated: May 07, 2026