Task 1: How to Keep NHANES I Data

Step 1 Keep variables

Because you are interested only in a subset of the
variables, you can use the keep option statement to select relevant
variables. No output is associated with this procedure, so you will need to
check the SAS log file to make sure that the procedure was completed
successfully. Additionally, you can use SAS Explorer to see that the new
datasets (Anthro, Biochem, Exam, AdultHistory, GenMedical) are in your WORK
library.

Program to Directly Keep
Datasets

Statements

Explanation

data biochem;

Use
the data step to create a dataset for your biochemistry data
(biochem).

set
nh1.biochem;

Use the set statement to bring in the
biochemistry file.

keep
seqn N1LB0237;

Use the keep statement to select
the variables of interest.

IMPORTANT NOTE

Notice that in the keep statement, a variable
named "seqn"
is included. SEQN stands for sequence
number and should be included whenever datasets are
appended. SEQN is a unique identifier for each
observation (participant) in NHANES. Every time you
extract variables from an NHANES III data file, you
should include the SEQN variable in your selection.
Failing to do so will lead to problems if you want to
sort or merge your data files at a later time. See Keep
& Merge Module Task 2 for more information on Merging.

data
exam;

Use the data step to create a dataset for your examination data (exam).

set
nh1.exam;

Use
the set statement to bring in the examination file.

keep
seqn N1ME0228 N1ME0231 N1ME0718 N1ME0721;

Use the keep statement to select the variables of interest.

data
adulthistory;

Use the data step to create a dataset for your adult history questionnaire data (AdultHistory).

set
nh1.adulthistory;

Use the set statement to bring in the adult history
questionnaire file.

keep
seqn N1AH0290 N1AH0423 N1AH0284 N1AH0287 N1AH0288 N1AH0293

N1AH0294 N1AH0472;

Use the keep statement to select the variables of interest.

data
anthro;

Use the data step to create the dataset for your anthropometric measurement data (anthro).