Task 1a: How to Set Up a t-test in NHANES Using SUDAAN

In this task, you will use SUDAAN to calculate a t-statistic and assess whether the mean systolic blood pressures (SBP) in males and females age 20 years and older are statistically different.

 

Step 1: Set Up SUDAAN to Produce Means

Follow the steps in the summary table below to produce the mean SBP using the SUDAAN procedure proc descript.

 

Info iconIMPORTANT NOTE

These programs use variable formats listed in the Tutorial Formats page. You may need to format the variables in your dataset the same way to reproduce results presented in the tutorial.

SUDAAN proc descript Procedure for Means
Statements Explanation
proc sort data =analysis_data;

by sdmvstra sdmvpsu;

run ;

Use the SUDAAN procedure, proc sort, to sort the data by strata (sdmvstra) and PSU (sdmvpsu).

proc descript

data=analysis_data design=wr;

Use the proc descript procedure to generate means and specify the sample design using the design option WR (with replacement).

nest sdmvstra sdmvpsu;

Use the nest statement with strata and PSU to account for the design effects.

weight wtmec4yr;

Use the weight statement to account for the unequal probability of sampling and non-response.  In this example, the MEC weight for 4 years of data (wtmec4yr) is used.

subpopn ridageyr >= 20 ;

Use the subpopn statement to select those 20 years and older.

Because only those 20 years and older are of interest in this example, use the subpopn statement to select this subgroup. Please note that for accurate estimates of the standard error , it is preferable to use subpopn in SUDAAN to select a subgroup for analysis, rather than select the study subgroup in SAS when preparing the data file. (See Section 5.4 of Korn and Graubard Analysis of Data from Health Surveys, pp 207-211.)

class riagendr/NoFREQ;

Use a class statement for categorical variables in version 9.0. In earlier versions, you need a subgroup and levels statement. Use the nofreq option to suppress frequencies.

var bpxsar;

Use the var statement to choose the continuous variable, systolic blood pressure (bpxsar).

print nsum mean semean/style=nchs;

&nbp;

Use the print statement to obtain the N (nsum), mean (mean) and standard error of the mean (semean) for the t-test.

rformat riagendr sexfmt. ;

Use the rformat statement to read the SAS formats into SUDAAN.

rtitle "Mean systolic blood pressure: NHANES 1999-2002"

run ;

Use the rtitle statement to title the output.

 

Step 2: Review SUDAAN Means Output

 

Step 3: Perform t-test to Test for Significance

A t-test is used to test whether the mean SBP between males and females obtained in the previous step is statistically significant different.

Request the t-test from the SUDAAN procedure proc descript and follow the steps in the summary table below.

Info iconIMPORTANT NOTE

Note that this program and the previous program to produce means in Step 1 are identical up to the var statement.

 

Info iconIMPORTANT NOTE

These programs use variable formats listed in the Tutorial Formats page. You may need to format the variables in your dataset the same way to reproduce results presented in the tutorial.

SUDAAN Procedure for Significance Test
Statements Explanation
proc sort data =analysis_data;

by sdmvstra sdmvpsu;

run ;

Use the SUDAAN procedure, proc sort, to sort the data by strata (sdmvstra) and PSU (sdmvpsu).

proc descript

data=analysis_data design=wr;

Use the proc descript procedure to generate means and specify the sample design using the design option WR (with replacement).

nest sdmvstra sdmvpsu; 

Use the nest statement with strata and PSU to account for the design effects.

weight wtmec4yr;

Use the weight statement to account for the unequal probability of sampling and non-response.  In this example, the MEC weight for 4 years of data (wtmec4yr) is used.

subpopn ridageyr >= 20

Use the subpopn statement to select those 20 years and older.

Because only those 20 years and older are of interest in this example, use the subpopn statement to select this subgroup. Please note that for accurate estimates of the standard error , it is preferable to use subpopn in SUDAAN to select a subgroup for analysis, rather than select the study subgroup in the SAS program while preparing the data file. (See Section 5.4 of Korn and Graubard Analysis of Data from Health Surveys, pp 207-211.)

class riagendr/NoFREQ;

Use a class statement for categorical variables in version 9.0. In earlier versions, you need a subgroup and levels statement. Use the nofreq option to suppress frequencies.

var bpxsar; 

Use the var statement to choose the continuous variable, systolic blood pressure.

contrast riagendr = ( 1 - 1 )/name = "Males vs. Females" ;

Use the contrast statement to test the hypothesis that the difference equal 0, or mean SBP for males equals the mean SBP for females.

print nsum t_mean p_mean/style=nchs;

Use the print statement to obtain the N (nsum), t-test, and p-value for the t-test.

rformat riagendr sexfmt. ;

Use the rformat statement to read the SAS formats into SUDAAN.

rtitle "Significance test for difference between mean systolic blood pressure for males and females" ; rtitle2 "NHANES 1999-2002" ;

Use the rtitle statement to title the output.

 

Step 4: Review SUDAAN t-test Output

 

 

close window icon Close Window