Task 1b: How to Set Up a t-test in NHANES Using SAS 9.2 Survey Procedures

In this task, you will use SAS Survey Procedures 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: Create Variable to Subset Population

In order to subset the data in SAS Survey Procedures, you will need to create a variable for the population of interest. In this example, the sel variable is set to 1 if the sample person is 20 years or older, and 2 if the sample person is younger than 20 years. Then this variable is used in the domain statement to specify the population of interest (those 20 years and older).

if ridageyr GE 20 then sel = 1;

else sel = 2;

 

Step 2: Set Up SAS Survey Procedures to Produce Means

Follow the explanations in the summary table below to produce the mean SBP using the SAS Survey procedure proc surveymeans.

 

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.


SAS proc surveymeans Procedure for Means
Statements Explanation
proc surveymeans data=analysis_data nobs mean stderr;

Use the SAS Survey procedure, proc surveymeans, to count the number of observations (nobs) and calculate means (mean) and standard errors (stderr), and specify the dataset (analysis_Data).

strata sdmvstra;