SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Reading Raw Data
Writing the DATA Step Program


Using the PAD Option

Many raw data files contain data lines of different lengths. This can cause problems when you attempt to read the raw data into your SAS data set. You can avoid these problems by using the PAD option in the INFILE statement.


Raw Data File Sales

1---+----10---+----20
Jones M 48 128.6 
Laverne M 58 158 
Jaffe F 33 115.5 
Wilson M 28 170.1 
Harmon F 34 
Haverman F 31 130.4  


     infile sales pad;
The PAD option pads each data line with blanks to the logical record length, so that all records have the same length. The value for the logical record length is dependent on the operating environment.

You can use the LRECL= option with the PAD option to specify the logical record length. If you don't use the LRECL= option, the SAS system chooses a value based on the host system's file characteristics. For details on logical record length, see the SAS documentation for your operating environment.

     infile sales pad lrecl=n;
You don't need to use the PAD option for the exercises in this lesson. However, when you write subsequent DATA steps, remember to determine whether you need to use the PAD option.

Caution: The PAD option can only be used when missing data occurs at the end of a record.


back||next


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

Terms of Use & Legal Information | Privacy Statement