SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Creating Multiple Observations from a Single Record
Reading a Varying Number of Repeating Fields


Completing the DO WHILE Loop

Now look at the other statements that should be executed in the DO WHILE loop. First, you need an OUTPUT statement to write the current observation to the data set. Then, another INPUT statement reads the next value for Sales and holds the record. Complete the DO WHILE loop with an END statement.

     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; 

back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement