| Creating a Single Observation from Multiple Records | |
| Reading Multiple Records in Any
Order |
|
| Using the #n Line Pointer Control
Take a closer look at using the #n line pointer control in the following example. |
| The raw data file Patdata contains patient information
from a small group of general surgeons.
The first three records contain a patient's name, address, city, state, and ZIP code. The fourth record contains the patient's ID number followed by the name of the primary physician. |
Raw Data File Patdata
|
Suppose you want to read each patient's information in the following
order:
|
|
data perm.patients;
infile patdata;
input #4 ID $5.
|
|
|
data perm.patients;9
infile patdata;
input #4 ID $5.
#1 Fname $ Lname $
|
|
|
data perm.patients;
infile patdata;
input #4 ID $5.
#1 Fname $ Lname $
#2 Address $23.
|
|
|
In this raw data file, the values for City contain eight
characters or less and do not contain embedded blanks. So, you can use standard
list input to read these values. |
data perm.patients;
infile patdata;
input #4 ID $5.
#1 Fname $ Lname $
#2 Address $23.
#3 City $ State $ Zip $
|
|
|
data perm.patients;
infile patdata;
input #4 ID $5.
#1 Fname $ Lname $
#2 Address $23.
#3 City $ State $ Zip $
#4 @7 Doctor $6.;
run;
|
|
![]() ![]() |
|
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.