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.
Iterative DO loops - SAS Tutorial
From the course: SAS® 9.4 Cert Prep: Part 13 Processing Repetitive Code
Iterative DO loops
- [Instructor] To eliminate having to type repetitive code, you can use the iterative DO loop. The DO loop starts with a DO statement, and ends with an END statement. During data step execution, the iterative DO loop processes statements between the DO and END statements repetitively. index-column names a column whose value controls the execution of the DO loop. The value of this column is incremented at the end of each pass through the DO loop. The index-column is included in the output table unless you drop it. In this example, Year is the index-column. We won't drop the index-column in the code because we want to have a column for year. Execution of the DO loop is based on the start value and stop value. Start is a number or numeric expression that specifies the initial value of the index-column. Stop is a number or numeric expression which specifies the value that the index-column must exceed to stop the execution…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.