From the course: SAS® 9.4 Cert Prep: Part 13 Processing Repetitive Code

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Demo: Executing an iterative DO loop

Demo: Executing an iterative DO loop

- In this example, we'll take a look at Enterprise Guide, and the DATA Step Debugger. To watch what happens behind the scenes, as a do loop processes. So in this program, we have a data step, where we're reading from an existing sas table, sashelp.shoes. And within the step we have a do loop. The index variable Year, indicates that loop should execute three times, for year one, two and three. So first I'll just run this program. And note that there are three rows now. Year one, two and three. For each combination of region, product and subsidiary. With projected sales, incrementing each year. So now I'll go back to the program tab, and turn on my DATA Step Debugger. Let's watch what happens step by step. First I'll execute the set statement, to load to first row from sashelp.shoes into the PDV. Remember _N_ indicates that this is the first iteration of the data step. The index variable Year, is added the the…

Contents