Reading Raw Data |
Writing the DATA Step Program |
Specifying the Raw Data
File
When reading raw data, use the INFILE statement to indicate which file the data is in. |
To do this... | Use this SAS statement... |
Reference SAS data library | |
Reference external file | |
Name SAS data set | data clinic.stress; |
Identify external file | INFILE statement |
General form, INFILE statement:
where file-specification can take the form fileref to name a previously defined file reference or 'filename' to point to the actual name and location of the file. |
Adding the OBS= option to the INFILE statement enables you
to process only through record n, so you can verify that the correct
fields are being read before reading the entire data file.
To specify that the raw data file assigned the fileref Census be read, you write the following INFILE statement: infile census obs=5; Note that instead of using a FILENAME statement, you can choose to identify the raw data file by specifying the entire name and location in the INFILE statement. For example, the following statement points directly to the C:\Irs\Personal\refund.dat file: infile 'c:\irs\personal\refund.dat'; |
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.