Task 3a: How to Extract and Copy NHANES Data Files to Permanent Libraries

There are three steps to extracting a SAS transport file and copying it to a permanent library:

 

Step 1 Assign libnames

In your SAS program, you will need to first assign a libname to the place where you'd like the permanent file to be and the transport file you downloaded in Task 2.
 

Assign libnames

Statements Explanation
libname NH "C:\NHANES\DATA"; Assigns the libname NH to the C:\NHANES\DATA folder. This is where the new dataset will be saved. Remember to surround the pathname in quotation marks.
libname XP xport "C:\NHANES\TEMP\bpx_b.xpt"; Assigns the libname XP to the SAS transport file, bpx_b.xpt, stored in the TEMP folder. The xport statement tells SAS to extract the data from the transport file using the XPORT engine.

 

Step 2 Copy to permanent library

Use proc copy to copy the extracted data file to a permanent SAS library.

proc copy

Statements Explanation
proc copy in=XP out=NH;
run;
Copies the extracted dataset from the transport file to the C:\NHANES\DATA folder.

 

Step 3 Check results

To check the results of your program, open Windows Explorer and go to your C:\NHANES\DATA folder. You should now see bpx_b.sas in the folder. You now have the blood pressure examination dataset.

 

 

The activities for this module are to download, extract and save the data files you'll need for your analysis and to download the related documentation for the other three components of your analysis — demographics, blood pressure questionnaire, and Lab 13 (cholesterol).

 

close window icon Close Window.