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.
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.
Statements | Explanation |
---|---|
data =analysis_data; by sdmvstra sdmvpsu; ; |
Use the SAS procedure, proc sort, to sort the data by strata (sdmvstra) and PSUs(sdmvpsu) before running the procedure in SUDAAN. |
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. |