Task 4: How to Create New Variables

This task reviews how to
recode or derive new variables so they are appropriate for your
analytic needs and how to
check recoded or derived variables.

The steps below assume that you are already familiar with the SAS code to create new variables in NHANES datasets. If you need more detailed instructions, please review the Clean & Recode Data module in the Continuous NHANES Web Tutorial before continuing.

Phthalate Data (1999–2004):

Step 1: Recode or Derive New Variables

Creating new variables, by recoding or deriving, is an
important step when preparing your analytic dataset. This is particularly true
when you prepare an analytic dataset from different cycles of environmental
chemical data. For some of the survey cycle data files, the indicator variable,
which identifies values at or above or below LOD, has not been included as a
"variable". You may want to create a new variable using multiple existing
variables and different cut points. In addition, you may want to create a
creatinine-adjusted variable of interest if a chemical is measured in urine.

The sample code below shows how to recode and derive new variables in
multiple scenarios, using the SAS DATA step.

Additional Resources

For a detailed explanation of the procedures, please see
Task 4: Recode Variables of the Clean & Recode module in the Continuous
NHANES Web Tutorial.

In each of the modules on Preparing an Analytic Dataset, you will be
working with temporary datasets, which are saved in the WORK folder
of your SAS program. The dataset exists only as long as your SAS
session and is deleted when you exit the program. If you would like
to save these datasets so that you can return to them at a later
time, you can learn how to do this in the
Save a Dataset module at the end of this course.