SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

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


Each record in the file Tempdata contains three blocks of data. Each block contains a date followed by the day's high temperature in a small city located in the southern United States.


Raw Data File Tempdata
1---+----10---+----20---+----30--
01APR90 68 02APR90 67 03APR90 70
04APR90 74 05APR90 72 06APR90 73
07APR90 71 08APR90 75 09APR90 76
10APR90 78 11APR90 70 12APR90 69
13APR90 71 14APR90 72 15APR90 74
16APR90 73 17APR90 71 18APR90 75
19APR90 75 20APR90 73 21APR90 75
22APR90 77 23APR90 78 24APR90 80
25APR90 78 26APR90 77 27APR90 79
28APR90 81 29APR90 81 30APR90 84


You could write a DATA step that reads each record and creates three different Date and Temp variables.


SAS Data Set
Date1 Temp1 Date2 Temp2 Date3 Temp3
11048 68 11049 67 11050 70


But if you create a separate observation for each block of data in a record, you can later use several statistical procedures to analyze the data for each day.

SAS Data Set
Date HighTemp
11048 68
11049 67
11050 70



back||next


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

Terms of Use & Legal Information | Privacy Statement