Creating Multiple Observations from a Single Record |
Reading a Varying Number of Repeating Fields
![]() |
Processing a DATA Step with a Varying Number of
Repeating Fields
Here is the new version of the DATA step. |
data perm.sales97; infile data97 missover; input ID $4. Sales : comma. @; Quarter=0; do while (sales ne .); quarter+1; output; input sales : comma. @; end; run; |
Select buttons below to view a series of graphics that depict DATA step processing of a varying number of repeating fields. |
The DATA step continues executing until all of the values
for Sales are read. PROC PRINT output for the data set shows
a varying number of observations for each employee. |
proc print data=perm.sales97; run; |
Obs | ID | Sales | Quarter |
1 | 1824 | 1323.34 | 1 |
2 | 1824 | 2472.85 | 2 |
3 | 1943 | 2199.23 | 1 |
4 | 2046 | 3598.48 | 1 |
5 | 2046 | 4697.98 | 2 |
6 | 2046 | 4598.45 | 3 |
7 | 2063 | 4963.87 | 1 |
8 | 2063 | 3434.42 | 2 |
9 | 2063 | 2241.64 | 3 |
10 | 2063 | 2759.11 | 4 |
![]() ![]() ![]() ![]() ![]() ![]() |
|
![]() |
![]() |
Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.