Creating Multiple Observations from a Single Record |
Reading a Varying Number of Repeating Fields
![]() |
Using the MISSOVER Option
You can adapt the DATA step to accommodate a varying number of values for
Like the previous example with the same number of repeating fields, your
DATA step must read the same record more than once. However, you need to
prevent the input pointer from moving to the next record when there are missing
values for |
data perm.sales97; infile data97; input ID $4. @; do Quarter=1 to 4; input Sales : comma. @; output; end; run; |
You can use the MISSOVER
option in an INFILE statement to prevent the SAS System from reading
the next record when missing values are encountered at the end of a record.
Essentially, records that have a varying number of repeating fields are records
that contain missing values, so you need to specify the MISSOVER option here
as well.
Because there is at least one value for the repeating field,
|
data perm.sales97; infile data97 missover; input ID $4. Sales : comma. @; |
1---+----10--V+----20---+----30---+----40 |
1824 1,323.34 2,472.85 |
1943 1,908.34 |
2046 1,423.52 1,673.46 3,276.65 |
2063 2,345.34 2,452.45 3,523.52 2.983.01 |
![]() ![]() ![]() ![]() ![]() ![]() |
|
![]() |
![]() |
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.