## Task 4b: How to Set Up a T-Test in NHANES Using SAS Survey Procedures

In this task, you will use SAS to calculate a t-statistic and assess whether the mean systolic blood pressure in calcium users vs. non-users ages 20 years and older is statistically different.

### Step 1: Identify variables

This example uses the demoadv dataset (download at Sample Code and Datasets).  The t-test is used with one continuous variable and one dichotomous variable.  The dataset contains a created variable called anycalsup that has a value of 1 for those who report calcium supplement use, and a value of 2 for those who do not.  A participant was considered not to have any calcium supplement use if the daily average amount of calcium supplement use was zero; otherwise, a participant was considered a supplement user (see Supplement Code under Sample Code and Module 9, Task 4 for more information). A variable called sel is created that defines those individuals 20 years old and older. Blood pressure is measured in the MEC; therefore MEC weights are used in the analysis. The demoadv dataset for this example only includes those with MEC weights (wtmec2yr>0):

if wtmec2yr> 0 ;
if ridageyr >= 20 then sel= 1 ;
else sel= 2 ;
run ;

### Step 2: Compute Properly Weighted Estimated Means

#### Compute Properly Weighted Estimated Means

Statements Explanation

proc surveymeans data =demoadv nobs mean stderr ;

Use the proc surveymeans procedure to obtain number of observations, mean, and standard error.

stratum sdmvstra;

Use the stratum statement to define the strata variable (sdmvstra).

cluster sdmvpsu;

Use the cluster statement to define the PSU variable (sdmvpsu).

class anycalsup;

Use the class statement to specify the discrete variables used to form the subpopulations of interest. In this example, the subpopulation of interest is by supplement use (anycalsup).

domain sel sel*anycalsup;

Use the domain statement to specify the table layout to form the subpopulations of interest. This example uses age greater than or equal to 20 (sel) by supplement use (anycalsup).

var mean_sbp;

Use the var statement to name the variable(s) to be analyzed. In this example, the mean systolic blood pressure variable (mean_sbp) is used.

weight wtmec2yr;

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

format anycalsup yesnos. ;

Formats the anycalsup variable.

### Step 3: Interpret Results

Highlights from the output include:

• 4,392 respondents ages 20 and older were included in this analysis; 2,050 respondents were supplement users and 2,342 were non-users.
• The mean systolic blood pressure for calcium supplement users ages 20 years and older was 124.3 and the mean calcium intake for non-users ages 20 and older was 122.2.

### Step 4: Use a t-test to Test for Significance

A t-test is used to test whether the mean systolic blood pressure in calcium supplement users is statistically different from the mean systolic blood pressure in non-users. In SAS, a simple linear model using proc surveyreg may be used to obtain the t-test.

#### Code to Test for Significance

Statements Explanation

Use the proc surveyreg procedure to obtain number of observations, mean, and standard error.

stratum sdmvstra;

Use the stratum statement to define the strata variable (sdmvstra).

cluster sdmvpsu;

Use the cluster statement to define the PSU variable (sdmvpsu).

model mean_sbp=anycalsup;

Use the model statement to specify the outcome variable (mean_sbp) and the 2-level variable used to form the subpopulation of interest. In this example, the subpopulation of interest is by supplement use (anycalsup).

domain sel;

Use the domain statement to specify the table layout to form the subpopulations of interest. This example uses age greater than or equal to 20 (sel) by supplement use (anycalsup).

weight wtmec2yr;

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

format anycalsup yesnos. ;

Formats the anycalsup variable.

Highlights from the output include:

• 4,392 respondents ages 20 years and older were included in this analysis where sel=1.
• The null hypothesis is that there is no relationship between systolic blood pressure and calcium supplement use, or that the mean systolic blood pressure  for supplement users equals the mean systolic blood pressure for non-users.  To test this hypothesis, the t-statistic with 15 degrees of freedom is computed as 3.73. The p-value is 0.0020.  The difference is 2 mm Hg.
• Therefore, the null hypothesis is rejected at the 0.05 level and it is concluded that the mean systolic blood pressure in calcium supplement users does not equal the mean systolic blood pressure in non-users.