There are four steps to opening an executable file and saving a SAS dataset in a permanent library:
To execute the file, you double-click on the .EXE file in your temp folder and it will automatically expand. You should now see a file in the TEMP folder with the suffix .TXT indicating it is in ASCII format. The .TXT file will be substantially larger than the original .EXE file.
There are two SAS programs available to create your own SAS dataset: DU5302_F.SAS and DU5302.SAS. The first program includes format statements and procedure whereas the second one does not. In most cases you will find it helpful to have variable values labeled and thus you will want to use the file DU5302_F.SAS. This is demonstrated below in Option 1.
Double-click the file in your TEMP folder and it will automatically launch SAS. First you will need to modify the INFILE statement to show the correct path. The path should direct you to the folder where the extracted ASCII file resides. If you followed the steps in Task 1 "Create a Directory" then the path in your INFILE statement should read "C:\NHANES II\TEMP" . Then you will need to add a libname statement. Assign a libname to the place where you'd like the permanent file to be. Remember this step only creates a temporary SAS dataset (D_5302) that will be saved as a permanent dataset later in Step 3.
As noted in the "Data Structure and Contents" module, Formatted SAS code files are not available for the Chest X-Ray Exam data file, the Electrocardiogram data file, and the Model Gram data file. The example in the option 2 below can be used to download and save these data files. For the 24-Hour Specific Food Item data file, no SAS code files are available and the user must write their own code. It may be helpful to use one of formatted SAS programs provided in this tutorial as a template to create your own code. For the Herpes and Hepatitis data file and the Syphilis Serological Markers data file, SAS transport files are provided, which do not need either of the SAS programs. For these data files, you can follow directions in the Continuous NHANES Web Tutorial module on Download Data Files to download SAS transport files.
Statements | Explanation |
---|---|
libname NH2 "C:\NHANES II\DATA"; |
Assigns the libname NH2 to the C:\NHANES II\DATA folder. This is where the new dataset will be saved. Remember to surround the pathname in quotation marks. |
The tables of code describe the statements used in each program, but are abbreviated to only show a few variables. To view the complete code that includes all the variables, please see the formatted SAS code provided on the NHANES II page.
Statements | Explanation |
---|---|
VALUE
PE0055F
VALUE
PE0056F
VALUE
PE0057F |
Use the proc format statement and procedure, included in the DU5320_F.SAS program provided, to label all values of categorical variables. |
D_5302; INFILE "c:\NHANES II\TEMP\DU5302.txt" LRECL = 2000 MISSOVER ;
LENGTH
FORMAT
INPUT LABEL ...
N2PE0055 =
"Q4 SEX"
N2PE0056 =
"Q5 (SEE DETAILED NOTES) RACE"
N2PE0057 =
"Q6 (SEE DETAILED NOTES IN |
Use the data statement to read in the ASCII data file from your existing TEMP folder and create a temporary SAS dataset.
The DATA step includes the INFILE and INPUT statements to read in the data. The FORMAT statement assigns the formats created in the format procedure and the LABEL statement names each variable. |
If you wish to simply read in the data and create the variable names without labeling all the categorical variable values you should open and run the DU5302.SAS program. This program will allow you to read in the ASCII data file from your existing TEMP folder and create a temporary SAS dataset. This is demonstrated below in Option 2. Later on in step 3, this temporary SAS dataset D_5302 will be saved as a permanent dataset.
Statements | Explanation |
---|---|
D_5302; INFILE "c:\NHANES II\TEMP\DU5302.txt" LRECL = 2000 MISSOVER ; LENGTH SEQN 8 ...
N2PE0055
4 SEQN 1 - 5 … N2PE0006 6 - 9 N2PE0010 10 N2PE0011 11 ... ; |