Lesson 21: More on Importing Data - Part II

Printer-friendly versionPrinter-friendly version

Introduction

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.

Learning objectives & outcomes

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 (@) the end of an INPUT statement to tell SAS to hold a record in the input buffer
  • know when it is appropriate to use the double trailing @@
  • know when it is appropriate to use the single trailing @

Our "to do" list for this lesson

In order to complete the lesson you should:

  1. check Read the lesson pages that follow.
  2. Type up your answers to the homework problems that follow the lesson in a Word file named homework21_yourPSUloginid. That is, if your PSU user id is xyz123, then name your file homework21_xyz123. Upload the file to the Lesson #21 Homework Dropbox.
  3. Post any questions or comments you have concerning the lesson's material to the Lesson #21 General Discussion Board.
  4. Take the Lesson #21 Mastery Quiz. Remember two things: i) You have 20 minutes to complete the quiz, and ii) as soon as you hit the "submit" button, your answers are submitted and graded, and the quiz becomes closed to you.