The second task is to check the data for skip patterns. To do this, you will use the:
Check the codebook to determine if a skip pattern affects the variables in your analysis. See the Locate Variables module Task 1 for more information on how to locate background information on variables in the documentation.
After you have used the codebook to discover if a skip pattern affects variables in your analysis, you will use cross tabulations obtained by the SAS proc freq procedure to determine the presence of skip patterns.
Statements | Explanation |
---|---|
Proc freq data=demo_BP1; |
Use the proc freq procedure to determine the frequency of each value of the variables listed. |
where ridstatr=2 and ridageyr>=20; | Use the where statement to select participants who were interviewed and examined in the MEC and who were age 20 years and older. |
table BPQ020 BPQ030 BPQ050a BPQ020*(BPQ030 BPQ050a)/list missing; title 'Check skip pattern for BP questionnaire'; run; |
Use the table 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 a star (*) indicates that a crosstab will be constructed with BPQ.020 as the row variable and BPQ.030 and BPQ.050a as the column variables. |
Highlighted items from the proc freq output for skip patterns:
To recode the missing data due to skip patterns, you can either:
Using the SAS if, then, and else statements you can either recode the variable directly or create a new variable (derived from the values of the variables in the skip pattern sequence).
Statements | Explanation |
---|---|
Data
demo_BP2a; |
Use data and set statements to refer to your analytic dataset. |
If BPQ030=1 then BPQ030=1; Else if BPQ020 in (1,2) and BPQ030 <7 then BPQ030=2; Else BPQ030=.; |
Use the if, then, and else statements to directly recode BPQ.030
values based on the BPQ.020 values.If you recode this way, the original variable BPQ.030 is modified and the original values will no longer be available should you need to use this variable again somewhere else. |
Proc
freq
data=demo_BP2a; |
Use the proc freq procedure to determine the frequency of each value of the variables listed; use the data statement to refer to your analytic dataset; use the where statement to select participants who were interviewed and examined in the MEC (ridstatr=2) and who were age 20 years and older (ridageyr>=20); use the table statement to indicate variables of interest for the output. |
Statements | Explanation |
---|---|
Data
demo_BP2b; |
Use the data and set statements to refer to your analytic dataset. |
If
BPQ030=1
then
diagHTN=1; |
Use the if, then, and else statements to create a new, derived variable (diagHTN) based on the BPQ.030 and BPQ.020 values. |
Proc
freq
data=demo_BP2b; |
Use the proc freq and table statements check the derived variable (diagHTN) against the original variables (BPQ.020 and BPQ.030); use the data statement to refer to your analytic dataset; use the where statement to select participants who were interviewed and examined in the MEC (ridstatr=2) and who were age 20 years and older (ridageyr>=20); use the table statement to indicate variables of interest for the output. |
Highlighted items from the recode output for skip patterns: