Reading a Varying Number of Repeating Fields
The Basics of Reading a Varying Number of Repeating Fields
Suppose that some of the employees quit at various times. Their records might not contain sales totals for the second, third, or fourth quarters. These records contain a variable number of repeating fields.
Figure 21.30 Raw Data File Data97 Showing Empty Records
The DATA step that you just wrote does not work with a variable number of repeating fields because now the value of Quarter is not constant for every record.
data perm.sales07; infile data07; input ID $ @; do Quarter=1 to 4; input Sales : comma. @; output; end; run;
Get SAS Certification Prep Guide, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.