Creating Multiple Observations from a Single Record |
Reading the Same Number of Repeating Fields
|
So far, you have created multiple observations from a single
record by executing the DATA step once for each block of data in a record.
Now, look at another file that is organized differently. Each record in the file Data97 contains a sales representative's ID number, followed by four repeating fields that represent his or her quarterly sales totals for 1997. |
You want to pair each employee ID number with one quarterly sales total to produce a single observation. That way, four observations can be derived from one record. |
Raw Data File Data97
1---+----10---+----20---+----30---+----40
0734 1,323.34 2,472.85 3,276.65 5,345.52
0943 1,908.34 2,560.38 3,472.09 5,290.86
1009 2,934.12 3,308.41 4,176.18 7,581.81
1043 1,295.38 5,980.28 8,876.84 6,345.94
1190 2,189.84 5,023.57 2,794.67 4,243.35
1382 3,456.34 2,065.83 3,139.08 6,503.49
1734 2,345.83 3,423.32 1,034.43 1,942.28
ID
Quarter
Sales
0734
1
1323.34
0734
2
2472.85
0734
3
3276.65
0734
4
5345.52
0943
1
1908.34
0943
2
2560.38
0943
3
3472.09
0943
4
5290.86
To accomplish this, you must execute the DATA step once for each record, repetitively reading and writing values in one iteration. |
This means that a DATA step must
|
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.