Task 1: How to Save NHANES Datasets

Here are the steps to save an NHANES dataset:


Step 1: Save as a Permanent Dataset

In order to save a temporary dataset as a permanent dataset in a SAS library, you will need to use the DATA and SET statements.  The sample code below, which comes from the “Supplement” program, shows how to save the temporary dataset, DEMOOST, as a permanent SAS dataset, called OSTEO_ANALYSIS_DATA. This permanent dataset will be saved in the SAS library, NH, which was created in the Download Data Files Module (please note that if you set up your file structure differently than what was presented in that module, you will need to adjust your SAS program accordingly).


Program to Save a Temporary Dataset

Sample Code

* Use the LIBNAME statement to specify the SAS library that your      ;
* permanent dataset will be saved to (NH).  Use the DATA statement to ;
* define the dataset that will be stored in the NH library.  Use the  ;
* SET statement to refer to the temporary dataset.                    ;

libname NH "C:\NHANES\DATA" ;
run ;


Step 2: Check that Dataset was Saved to SAS-accessible Library

To check that your dataset was saved to the NH library:

Double-click on NH library .The contents of NH library will be displayed in the right-hand window labeled "Contents" and should include your new permanent dataset, OSTEO_ANALYSIS_DATA.




close window icon Close Window to return to module page.