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 iterative DO loops

Demo: Using iterative DO loops

- [Instructor] In this example, we'll modify an existing DATA step with variations of iterative DO loops. We'll also play with the placement of the output statement to determine when rows are written to our output-table. We'll start with this savings SAS table. You'll notice it has four individuals and a different monthly savings amount for each one. Now I'll come over to my DATA step. In this DATA step we want to take a look at those four individuals and see how much they have saved after 12 months. So each month they add to their savings based on the amount in the savings table. They also earned interest each month. It's 2% annual interest but compounded monthly. My iterative DO loop in this code uses an index variable of month, the range going from one to 12. You'll notice there's no explicit output statement anywhere so output happens implicitly at the conclusion of each DATA step iteration. So let's run the DATA…

Contents