SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Creating Multiple Observations from a Single Record
Reading Repeating Blocks of Data


This example requires only one INPUT statement to read the values for Date and HighTemp, but the INPUT statement must execute three times for each record.

The INPUT statement reads a block of values for Date and HighTemp, and then holds the current record by using the @@. The values in the program data vector are written to the data set as an observation, and control returns to the top of the DATA step.

     data perm.april90;  
        infile tempdata;
        input Date : date. HighTemp @@;

Raw Data File Tempdata
1---+----1V---+----20---+----30--
01APR90 68 02APR90 67 03APR90 70
04APR90 74 05APR90 72 06APR90 73
07APR90 71 08APR90 75 09APR90 76


In the next iteration, the INPUT statement reads the next block of values for Date and HighTemp from the same record.


Raw Data File Tempdata
1---+----10---+----2V---+----30--
01APR90 68 02APR90 67 03APR90 70
04APR90 74 05APR90 72 06APR90 73
07APR90 71 08APR90 75 09APR90 76



back||next


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

Terms of Use & Legal Information | Privacy Statement