There are three steps to extracting a SAS data file and copying it to a permanent library:
In the SAS code file for the Medical Examination, Ages 1-74 years, 4233, you downloaded in the previous task, you will need to modify the pathway for the Filename where you downloaded the data file and assign a libname to the place where you'd like the permanent file to be. The example below and the complete, downloadable program, available on the Downloads page, assume that you used the directory structure shown in Task 1 of this module.
|Filename In "C:\NHANES I\TEMP\DU4233.TXT" LRECL=850;||
Assigns the filename "In" and identifies the path for the data file you will read into the SAS code as the C:\NHANES I\TEMP folder. This is where you downloaded and inflated the DU4233.TXT out of the 4233.EXE file from the NHANES website. Remember to modify the pathname according to your actual location and surround the pathname in quotation marks. Leave the LRECL statement intact as this identifies the size of the file being read into the program.
|libname NH1 "C:\NHANES I\DATA";||
Assigns the libname "NH1" and identifies the path for the SAS data file you will create as C:\NHANES I\DATA. Remember to modify the pathname according to your actual location and surround the pathname in quotation marks.
You will need to modify the Data step commands to identify the correct infiles and output files. Then you will need to append a run command at the bottom of the SAS code.
This modification assigns a name to the SAS data file you will output to the library and identifies the libname command "NH1" which specifies the location as the C:\NHANES I\DATA folder.
|Infile In missover;||
This identifies the filename command "In" which is the source of your input data file. The missover option prevents the input pointer from going to the next record if it fails to find values in the current line for all variables that are listed in the input statement.
This command in PC SAS is necessary to get the SAS code to run and complete the task.
To check the results of your program, open Windows Explorer and go to your C:\NHANES I\DATA folder. You should now see exam.sas7bdat in the folder. You have now the Medical Examination, Ages 1-74 years, 4233, SAS dataset.
The remaining activities for this module are to download, create and save the data files you'll need for your analysis and to download the related documentation for the other four components of your analysis: