Creating a Single Observation from Multiple Records | |
Reading Multiple Records in Sequential
Order |
Number of Records Per Observation
It's important to note that there must be the same number of records in the external file for each observation being created. For example, suppose that there are only two records for the second member. However, the INPUT statement is set up to read three records. |
data perm.members; infile memdata; input Fname $ Lname $ / Address $ 1-20 / City & $10. State $ Zip $; |
|
The second member's name and address are read and assigned to corresponding
variables. Then the input pointer advances to the next record, as directed
by the INPUT statement, and the third member's name is read as a value for
City .
Still looking for a value for PROC PRINT output for this data set illustrates the problem. |
Obs | Fname | Lname | Address | City | State | Zip |
1 | LEE | BEDWAN | PHOENIX | AZ | 85044 | |
2 | HEIDIE | BAKER | 1751 DIEHL ROAD | 131 | DONERAIL | |
3 | ATLANTA | GA | JOYCE BENEFIT | 85 MAPLE A | MENLO | PARK |
So, before you write the INPUT statement, make sure the raw data file contains the same number of records for each observation. |
|
The SAS System provides tools for working with raw data files that contain missing values. See the section on handling missing values in Step-by-Step Programming with Base SAS Software or the section on the SAS Language Reference: Dictionary for more information. |
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.