## Task 3a: How to Perform Chi-Square Test Using SUDAAN

In this task, you will use the chi-square test to determine whether gender and blood pressure cuff size are independent of each other.

### Step 1: Set Up SUDAAN to Perform Chi-Square Test

The chi-square statistic is requested from the SUDAAN procedure proc crosstab.  The summary table below provides an example of how to code for a chi-square test in SUDAAN.

IMPORTANT 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.

Calculating chi-square Using SUDAAN Procedure proc crosstab
Statements Explanation
proc sort data =analysis_data;

by sdmvstra sdmvpsu;

run ;

Use the SAS procedure, proc sort, to sort the data by strata (sdmvstra) and PSUs(sdmvpsu) before running the procedure in SUDAAN.

proc crosstab

data=analysis_data design=wr;

Use proc crosstab to examine the relationship between two categorical variables.

nest sdmvstra sdmvpsu;

Use the nest statement with strata (sdmvstra) and PSU (sdmvpsu) 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.

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 SAS when preparing the data file. (See Section 5.4 of Korn and Graubard Analysis of Data from Health Surveys, pp 207-211).

recode bpacsz = (1 3 4 5 );

Use the recode statement to regroup blood pressure cuff size from five categories to four categories. This collapses the infant and child groups.

class riagendr bpacsz/NoFreq;

Use the class statement for categorical variables in version 9.0. In earlier versions, you need a subgroup and levels statement. The NoFreq option suppresses printing frequencies in the output.

table riagendr*bpacsz;

Use the table statement to choose the categorical variables gender (riagendr) and blood pressure cuff size (bpacsz) for cross tabulation.

print nsum rowper colper/tests=all;

Use the print statement to obtain the N, row percent (rowper),and column percent (colper). Use the tests option to request all available statistics.

rformat riagendr sexfmt. ;

rformat bpacsz csz1fmt. ;

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

rtitle "Chi-square test for blood pressure cuff size: NHANES 1999-2002" ;

run ;

Use the rtitle statement to title the output.

IMPORTANT NOTE

SUDAAN Version 9.0 proc crosstab provides only limited chi-square results (Wald) with p-values based on unadjusted F-statistics (not the recommended statistic for complex survey data). However, the SUDAAN regression procedures do produce the recommended F adjusted chi-square statistics (e.g. Rao-Scott and Satterthwaite) for use in analyzing NHANES data.

### Step 2: Review Output

• 9,094 respondents have information on blood pressure cuff size.
• The row percentages indicate that males tend to have a larger cuff size than females.
• Because the p-value is less than 0.05, you would reject the null hypothesis that gender and blood pressure cuff size are independent. The probability of obtaining a value of 274.74 or more is approximately zero.