Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

SAS loop


May 26, 2021 SAS


Table of contents


You may encounter situations when a block of code needs to be executed several times. I n general, statements are executed sequentially: the first statement in a function executes first, then the second statement, and so on. B ut when you want to execute the same set of statements over and over again, we need Loops' help.

The SAS loop is done by using a DO statement. I t is also known as the DO loop. T he following is the general form of the DO loop statement in SAS.

Flow chart

SAS loop

The following is the type of DO loop in SAS.

S.N. The type and description of the loop
1. DO Index.

The loop continues from the starting value to the stop value of the index variable.

2. DO WHILE.

The loop continues until the while condition becomes false.

3. DO UNTIL.

The loop continues until theUNTIL condition becomes true.