| Creating Multiple Observations from a Single Record |
| Reading a Varying Number of Repeating Fields
|
| Creating a Counter Variable
Because the DO WHILE statement does not create an index-variable, you can create your own "counter" variable. You can then use a sum statement to increment the value of the accumulator variable each time the DO WHILE loop executes. |
General form, sum statement:
where
|
data perm.sales97;
infile data97 missover;
input ID $4. Sales : comma. @;
Quarter=0;
do while (sales ne .);
quarter+1;
|
![]() ![]() |
|
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.