Task 3c: How to Import and Save NHANES Data Files in Stata

There are three steps to importing SAS transport files and saving them as permanent Stata datasets:

 

Step 1 Import data file

Use the fdause command to import a file into Stata. The general format of this command is below.

fdause filename [,fdause_options]  

 

In your Stata program, you will use the fdause command to import and read the SAS transport file you downloaded in Task 2, bpx_b.xpt. Use the clear option to replace data in memory.

fdause "c:\NHANES\TEMP\bpx_b.xpt", clear

 

 

Step 2 Save Stata dataset

Use the save command to save a dataset in Stata. The general format of the command is below.

save  filename [,save options]  

 

You will use the save command to save your imported data, bpx_b.xpt, as a permanent Stata dataset, bpx_b.dta.

save "c:\NHANES\DATA\bpx_b.dta"

If filename is specified without an extension, .dta is assumed.

 

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.dta 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 components of your analysis — demographics, blood pressure questionnaire, medical conditions questionnaire, and Lab 13 (cholesterol) for 2001-2002 and 1999-2000.

 

close window icon Close Window.