O'Reilly logo

SAS Certification Prep Guide: Base Programming for SAS 9, Third Edition by SAS Institute

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Submitting the DATA Step Program

Verifying the Data

To verify your data, it is a good idea to use the OBS= option in the INFILE statement. Adding OBS=n to the INFILE statement enables you to process only records 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 ten records in the raw data file referenced by the fileref Tests. The data is stored in a permanent SAS data set, named Sasuser.Stress. Don't forget a RUN statement, which 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  
         TimeSec 42-43 Tolerance $ 45; 
run;
SAS Data Set sasuser.stress ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required