Introduction

Sometimes raw data files contain data for several observations in one record. Data is stored in this manner to reduce the size of the entire data file.

Each record can contain

  • repeating blocks of data that represent separate observations

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


  • an ID field followed by an equal number of repeating fields that represent separate observations

1---+----10---+----20---+----30--
001 WALKING AEROBICS CYCLING
002 SWIMMING CYCLING SKIING
003 TENNIS SWIMMING AEROBICS


  • an ID field followed by a varying number of repeating fields that represent separate observations.

1---+----10---+----20---+----30--
001 WALKING
002 SWIMMING CYCLING SKIING
003 TENNIS SWIMMING


This lesson shows you several ways of creating multiple observations from a single record.


Notice:

Setting Up Filerefs for Practices in This Lesson




1 hour



In this lesson, you learn to

  • create multiple observations from a single record that contains repeating blocks of data
  • create multiple observations from a single record that contains one ID field followed by the same number of repeating fields
  • create multiple observations from a single record that contains one ID field followed by a varying number of repeating fields.

Additionally, you learn to

  • hold the current record across iterations of the DATA step
  • hold the current record for the next INPUT statement
  • execute SAS statements based on a variable's value
  • explicitly write an observation to a data set
  • execute SAS statements while a condition is true.

complete the following lessons:

  • .