Task 2: How to Generate Confidence Intervals Using SUDAAN

In this example, you will be calculating means of dietary calcium intake.
The mean and its standard error are obtained directly from the PROC DESCRIPT
procedure in SUDAANand then output into a SAS dataset where the
confidence intervals can be constructed.

Step 1: Sort Data

Before running
any SUDAAN procedure, sort the data by strata and PSUs, using the PROC SORT
procedure.

Step 2: Generate Means

Use the PROC DESCRIPT procedure to generate means. Use the ATLEVEL1=1 and
ATLEVEL2=2 options in the DATA statement to specify the sampling stages (in
NHANES, the number of strata is level 1, and the number of PSUs is level 2) for
which you want counts per table cell. ATLEV1 is the number of strata with at
least one valid observation and ATLEV2 is the number of PSUs with at least one
valid observation. These numbers are used to calculate degrees of freedom.

Use the NEST statement to account for the design effects of the survey and
the WEIGHT statement to account for the unequal probability of sampling and
non-response. Use the SUBPOPN statement to select the subpopulation of
interest. Use a CLASS statement to list the discrete variables upon which
subgroups are based and a VAR statement to list variables in the analysis. Use
the TABLE statement to obtain results for each gender.

The PRINT statement allows you to print the number of observations (NSUM),
means (MEAN), and standard error of the mean (SEMEAN). The OUTPUT statement
outputs the number of observations (NSUM), means (MEAN), standard error of the
mean (SEMEAN), number of strata (ATLEV1), and number of PSUs (ATLEV2) to a SAS
file named CALC0304.

Calculate Mean Calcium Intake, in Milligrams, among Males and
Females Ages 20 Years and Older Using SUDAAN

Sample Code

*-------------------------------------------------------------------------;
* Use the PROC SORT procedure to sort the data files by strata and
PSU. ;
* Data must always be sorted before running a SUDAAN
procedure. ;
*
;
* Use the PROC DESCRIPT procedure to estimate the mean dietary
calcium ;
* intake (DR1TCALC) by gender (RIAGENDR) in males and females ages
20 ;
* and
older.
These
statistics will be output
into a new dataset called ;
*
CALC0304
where the confidence intervals can be
constructed directly.
;
*-------------------------------------------------------------------------;

Step 3: Create New Dataset

Use a DATA
statement to create a new dataset called NEWCALC0304. Calculate the degrees of
freedom (DF) from the number of PSU (ATLEV2) minus the number of strata
(ATLEV1). Use a drop statement to drop selected variables from the dataset.
Use a series of statements to calculate the lower limit of the confidence
interval (LL), upper limit of the confidence interval (UL), mean (MEAN), and
width of the confidence intervals (CIWIDTH). Use the proc print
procedure to output these data.

Sample Code

*-------------------------------------------------------------------------;
* Create a new dataset called NEWCALC0304 which is based on the
dataset ;
* created in the last SUDAAN procedure. Confidence intervals around
the ;
* means and standard errors will be calculated using this new
dataset. ;
*-------------------------------------------------------------------------;

The mean calcium intake for males is 998 mg and
the mean calcium intake for females is 771 mg.

The width of the confidence interval (CI) is wider
for males than for females

Confidence intervals can also be used as a first
glance to see if two groups are different, for example the CI for mean
calcium intake for males (CI 952, 1045) and females (CI 738, 803) do not
overlap, indicating that the two groups are likely to be different.
However, a test for statistical difference, such as a t-test, should be
performed in order to definitively determine a significant difference
between the mean for two population sub-groups.