There are three steps to extracting a SAS transport file and copying it to a permanent library:
In your SAS program, you will need to first assign a libname to the place where you would like the permanent file to be and the transport file you downloaded in Task 2.
Statements | Explanation |
---|---|
libname NHANES "C:\NHANES\"; |
Assigns the libname NH to the C:\NHANES\ folder. This is where the new dataset will be saved. Remember to surround the pathname in quotation marks. |
libname XP xport "C:\NHANES\TEMP\demo.xpt"; |
Assigns the libname XP to the SAS transport file, demo.xpt, stored in the TEMP folder. The xport statement tells SAS to extract the data from the transport file using the XPORT engine. |
Use proc copy to copy the extracted data file to a permanent SAS library.
Statements | Explanation |
---|---|
proc copy in=XP out=NHANES; |
Copies the extracted dataset from the transport file to the C:\NHANES\DATA folder. |
To check the results of your program, open Windows Explorer and go to your C:\NHANES\ folder. You should now see demo.sas7bdat in the folder. You now have the demographic dataset.
Close Window to return to module page.