SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Creating a Single Observation from Multiple Records
Lesson Overview


Introduction

Information for one observation can be spread out over several records. You can write multiple INPUT statements to read each record that comprises a single observation . . .



input Lname $ 1-8 Fname $ 10-15;
input Department $ 1-12 JobCode $ 15-19;
input Salary comma10.;
1---+----10---+----
ABRAMS THOMAS 
MARKETING     SR01
$25,209.03  
BARCLAY ROBERT 
EDUCATION     IN01
$24,435.71  
COURTNEY MARK 
PUBLICATIONS  TW01
$24,006.16  


. . . or, you can write one INPUT statement that contains a line pointer control to specify the record(s) from which values are to be read.



input #1 Lname $ 1-8 Fname $ 10-15 
      #2 Department $ 1-12 JobCode $ 15-19 
      #3 Salary comma10.;
1---+----10---+----
ABRAMS THOMAS 
MARKETING     SR01
$25,209.03  
BARCLAY ROBERT 
EDUCATION     IN01
$24,435.71  
COURTNEY MARK 
PUBLICATIONS  TW01
$24,006.16  


In this lesson, you learn to create a single observation from multiple records by reading records in sequential order or in any order.

This lesson contains 19 pages and takes approximately 30-45 minutes to complete.


Objectives

In this lesson you learn to

  • read multiple records in a sequential order and create a single observation
  • read multiple records in any order to create a single observation.


Prerequisites

Before taking this lesson, you should have completed the following lessons

Introduction to SAS Programming

Creating SAS Data Sets

Reading Various Types of Raw Data

back||next


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

Terms of Use & Legal Information | Privacy Statement