Reading and Verifying the Data

Verifying the Code That Reads the Data

Before you read a complete external file, you can verify the code that reads the data by limiting the number of observations that SAS reads. Adding OBS=n to the INFILE statement enables you to process records only 1 through n, so you can verify that the correct fields are read before reading the entire data file.
The program below reads the first 10 records in the raw data file that is referenced by the fileref Tests. The data is stored in a permanent SAS data set, named sasuser.stress. The RUN statement tells SAS to execute the previous SAS statements.
data sasuser.stress; 
   infile tests obs=10; input ID $ 1-4 Name $ 6-25 RestHR 27-29 MaxHR 31-33 RecHR 35-37 TimeMin 39-40 ...

Get SAS Certification Prep Guide, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.