The Basics of DO Loops

The Basics of Using Grouping Statements and DO Groups

You can execute a group of statements as a unit by using DO groups.
To construct a DO group, you use the DO and END statements along with other SAS statements.
Syntax, DO group:
SAS statements
  • The DO statement begins DO-group processing.
  • SAS statements between the DO and END statements are called a DO group and are executed as a unit.
  • The END statement terminates DO-group processing.
Tip:You can nest DO statements within DO groups.
You can use DO groups in IF-THEN/ELSE statements and SELECT groups to execute many statements as part of the conditional action.

Example: DO and END Statements

In this simple DO group, ...

Get SAS Certified Specialist Prep Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.