| Creating Multiple Observations from a Single Record |
| Reading the Same Number of Repeating Fields
|
| Processing a DATA Step that Contains an Iterative
DO Loop
Now that the program is complete, let's see how the SAS System processes a DATA step that contains an iterative DO loop. data perm.sales97;
infile data97;
input ID $4. @;
do Quarter=1 to 4;
input Sales : comma. @;
output;
end;
run;
Select buttons below to view a series of graphics depicting the processing of a DATA step that contains an iterative DO loop. |
| When the execution phase is complete, you can display the data set with the PRINT procedure. |
proc print data=perm.sales97;
run;
|
| Obs | ID | Quarter | Sales |
| 1 | 0734 | 1 | 1323.34 |
| 2 | 0734 | 2 | 2472.85 |
| 3 | 0734 | 3 | 3276.65 |
| 4 | 0734 | 4 | 5345.52 |
| 5 | 0943 | 1 | 1908.34 |
| 6 | 0943 | 2 | 2560.38 |
| 7 | 0943 | 3 | 3472.09 |
| 8 | 0943 | 4 | 5290.86 |
| 9 | 1009 | 1 | 2934.12 |
| 10 | 1009 | 2 | 3308.41 |
| 11 | 1009 | 3 | 4176.18 |
| 12 | 1009 | 4 | 7581.81 |
![]() ![]() |
|
Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.