May 26, 2021 SAS
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.
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. |