Lesson 21: More on Importing Data - Part II

Overview Section

In this lesson, we'll focus on two special situations that you might encounter when trying to read an input raw data file into a SAS data set, namely:

  • When you need to read across several records in the input raw data file in order to create one observation in a SAS data set.
  • When you need to read from just one record in the input raw data file in order to create multiple observations in a SAS data set.

We'll learn how to use two different line pointer controls — the forward-slash (/) line pointer control and the pound-n (#n) line pointer control — to accomplish the first task. And, we'll learn how to use two different line-hold specifiers — the double trailing at sign (@@) and the single trailing at sign (@) — to accomplish the second task.

Objectives

Upon completion of this lesson, you should be able to:

Upon completing this lesson, you should be able to do the following:

  • read a raw data file into a SAS data set when the data values for one observation are spread out over several records in the file
  • use the forward-slash (/) line pointer control to read records in a raw data file sequentially
  • use the pound-n (#n) line pointer control to read records in a raw data file non-sequentially
  • read a raw data file into a SAS data set when the data values for multiple observations are contained in just one record in the input data file
  • read raw data files in which each record contains a repeating block of values in which each block in the record represents a separate observation
  • read raw data files in which each record contains an ID field followed by an equal number of repeating fields that contribute values to separate observations
  • read raw data files in which each record contains an ID field followed by a varying number of repeating fields that contribute values to separate observations
  • use the double trailing at sign (@@) at the end of an INPUT statement to tell SAS to hold a record in the input buffer across multiple iterations of the DATA step
  • use the single trailing at sign (@) at the end of an INPUT statement to tell SAS to hold a record in the input buffer
  • define when it is appropriate to use the double trailing @@
  • define when it is appropriate to use the single trailing @