Reading file from external source a text file, Csv, or xls may be stored in your own PC is a very important feature of SAS.
SAS Reads the file from external source, in that case we need to use infile statement or FILENAME.
Before you can read your raw data, you must point to the location of the external file that contains the data. You use the FILENAME statement to point to this location.
Reference an external file 1. FILENAME statement filename tests 'c:\users\tmill.dat';
2. INFILE statement filename 'c:\users\tmill.dat';
fileref i.e tests is a name that you associate with an external file. The name must be 1 to 8 characters long, begin with a letter or underscore, and contain only letters, numbers, or underscores.
Example: Data T;
filename tests 'c\user\tmill.dat';
input < variables>;
run;
Data T;
infile 'c\user\tmill.dat';
input < variables>;
run;
Reading Raw data files is done in 2 steps
A] Compilation
B] Execution
· When infile statement is encountered input buffer is created (Its default value is 256 bytes but can be changed using LRECL option) depending on one record size of the input file.
· When input statement is encountered then depending on number of variables PDV (Program Data Vector) is created into the memory.
· At the last descriptor portion of the output dataset is created
· These all 3 steps mentioned above take place at the compilation time.
Execution phase includes the exection of data steps and procedures and start processing data.
input statement allows you to select the data from the raw file.