SAS Infile Statement To Access Non SAS Datasets

An Infile Statement is used a in a SAS data step to identify the external file that should be used as input. The identifier following the infile keyword can be a previously defined fileref or the actual fill path name to the file that needs to be read. 

Simple example of a SAS Infile statement:

Data Cars;

INPUT Make $ 1-5 Model $ 6-12 MPG 13-14 Weight 15-18 Cost 19-23;

Infile 'c:\data\cars.txt';

RUN;

Alternatively, this following example uses an in-stream 'cards' data set and can be run from any SAS session to show a simple example of how the SAS Infile statement works.

DATA Cars;

INPUT Make $ 1-5 Model $ 6-12 MPG 13-14 Weight 15-18 Cost 19-23;

cards;

GMC Sierra 22293034099

GMC Envoy 17335034749

Ford Escort 13250412816

Ford Edge 15408019827

RUN;