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: Using conditional DO loops

Demo: Using conditional DO loops

- [Instructor] Let's take a closer look at conditional do loops. I'd like to show you the data first to get an idea of what we're working with. So we have in the savings2 table four rows for these individuals. The Savings column represents the starting savings amount and then each month they will contribute the value that's in the Amount column. I would like to point out Linda specifically. Note that her savings account is starting at $3,600. That value will be significant as we look at our program. So let's come back over to our code. In this data step, we're creating a temporary table called MonthSavings and reading that pg2.savings2 table. I'll jump right to the do until statement to look at the condition. This do statement indicates that we want the loop to execute until Savings equals 3,000. Remember, Linda's account already exceeds 3,000. We'll see what happens with her in a moment. Within the loop, we have a counter…

Contents