/* Sample SAS Program "sample.sas" */ /* ANA EXAMPLE OF READING A RAW DATA FILE FROM CISER DATA ARCHIVE AND CREATING A SAS DATASET OF SELECTED VARIABLES */ /*-------------------------------------------------------------------*/ filename in 'U:\ArchiveData\sind\001\da6492'; * assigns the fileref ("in") for the external file you want to read; libname ssd 'U:\users\your_netid\proj\'; * assigns a libref ("ssd") for the SAS data library where the SAS dataset will be located; options ls=79 ; * sets the line size of reports created to 79 columns/line; data ssd.mydata; * Creates a permanent SAS dataset called "mydata"; * uses the libref "ssd" assigned above to put the SAS dataset into the proper SAS library; * (note: to create a temporary dataset change to "data mydata"); infile in lrecl=3436; * Uses the fileref "in" assigned in the filename statement above; * Tells SAS the physical line length of the data file being read; input YEAR 1-2 ID 3-6 WRKSTAT 7 HRS1 8-9 HRS2 10-11 EVWORK 12 OCC 13-15 PRESTIGE 16-17; * names the variables you want to read/extract and gives SAS their column locations in the raw data file; * note: column information is obtained from documentation that accompanies the data; run; * runs the data step above; proc contents data=ssd.mydata; * produces a listing of the variables in your newly created dataset; run; * runs the proc contents statement above;