Be the first to like this
During the execution of the DATA step processing, the DATA step works like a loop, repetitively reading the data and creating observations one at a time. We call this type of loop the implicit loop. Sometimes we need to execute certain SAS® statements repeatedly. In this situation, we need to construct an explicit loop by using the DO, DO WHILE, or DO UNTIL statements. There is a wide range of applications for explicit loops, such as generating random samples, reading multiple external data files, and so forth. However, in some scenarios, creating an explicit loop can be very tricky, even for seasoned programmers. Constructing a successful loop is dependent upon grasping SAS® programming fundamentals, such as understanding that the SAS data set is created one observation at a time in the program data vector (PDV). In this paper, you will learn how to create loops with various applications and what happens in the PDV when creating the explicit loop.