Task 2: How to Identify and Recode Skip Patterns in NHANES Data

The second task is to check the data for skip patterns. To do this, you will:

 

Step 1: Check the Codebook for Skip Patterns

Check the codebook to determine whether a skip pattern affects the variables in your analysis. See Task 1 of the Locate Variables module for more information on how to use the documentation to obtain background information about your variables.

 

Skip Pattern in Osteoporosis Questionnaire Codebook

screenshot of skip pattern in osteoporosis questionnaire codebook

 

Step 2: Check the Data for Skip Patterns

After you have used the codebook to determine whether any of the variables in your analysis are part of a skip pattern, you will use the PROC FREQ procedure in SAS to obtain cross-tabulation tables using the variables that are part of the skip pattern.  This will help confirm the presence of the skip pattern in the data. This example is from the "Supplement" program.

 

Program to Check Data for Skip Patterns

Sample Code

*--------------------------------------------------------------------;
* Use the PROC FREQ procedure to determine the frequency of each     ;
* value of the variables listed.  Use the TABLES statement to list   ;
* the variables to be included in the output frequency table and the ;
* cross tabulation frequency table for the skip patterns.  Note that ;
* an asterisk indicates that a crosstab will be constructed.         ;
*--------------------------------------------------------------------;

proc freq data =DEMOOST;
      where WTINT2YR > 0 and RIAGENDR= 2 and RIDAGEYR >= 20 ;
      tables OSQ060*OSQ070/ list missing ;
      title 'Check skip pattern for osteoporosis questionnaire' ;
run ;

 

 

Output of Program

Click here to view program output and highlights

 

Step 3: Create New Variables, As Necessary

Using the SAS IF, THEN, and ELSE statements in a data step, you can create new variables derived from the values of the variables in the skip pattern sequence. This example is from the "Supplement" program.

For more information, see Task 4: Create New Variables.

 

Program to Create a New Variable

Sample Code

*--------------------------------------------------------------;
* Create a new variable called TREATOSTEO based on responses   ;
* to the variables OSQ060 and OSQ070.                          ;
*--------------------------------------------------------------;

data DEMOOST;
    set DEMOOST;
    if OSQ070=
1 then treatOSTEO= 1 ;
    else if OSQ070= 2 < or OSQ060=2 ; then treatOSTEO= 2 ;

run ;

*---------------------------------------------------------------;
* Use the PROC FREQ and TABLE statements to check the derived   ;
* variable (TREATOSTEO) against the original variables (OSQ060  ;
* and OSQ070).                                                  ;
*---------------------------------------------------------------;

Proc freq data =DEMOOST ;
where WTINT2YR > 0 and RIAGENDR= 2 and RIDAGEYR >= 20 ;
table TREATOSTEO*OSQ060*OSQ070/ list missing ;
format TREATOSTEO OSQ060 OSQ070 YESNO.
title 'Check derived variable TREATOSTEO' ;
run ;

 

Output of Program

Click here to view program output and highlights

 

 

 

close window icon Close Window to return to module page.