This section describes how to use SUDAAN to estimate a ratio of means for all adults and for males and females separately. To illustrate this, the sum of calcium from milk is divided by the sum of total calcium for each population group as an example.
Sort the data by strata and PSU. Data must always be sorted first when using SUDAAN. In the sample code below, DTTOT is the dataset that was created for this analysis with the appropriate variables of interest.
To compute a properly weighted estimated ratio of means, use the PROC RATIO procedure in SUDAAN. This procedure includes a required nest statement that identifies the variables for strata and PSU.
In the sample code below, note that the weight variable being used is for the dietary recall Day 1 subsample (WTDRD1). The subgroups statement indicates that the results will be reported by gender (RIAGENDR), which has two “levels” or categories (male and female). The variable D1MCALC was previously created to represent the total calcium contributed by milk for each individual on Day 1, and DR1TCALC is an NHANES variable representing total calcium consumed on Day 1 from all foods and beverages. The SUBPOPN statement identifies the subset of people that will be included in the analysis; USEDAT is a variable that has a value 1 if the individual is age 20 or older and has reliable recall data for Day 1, and has a value 0 otherwise.
*-------------------------------------------------------------------------;
* Use the PROC SORT procedure to sort the data by strata and
PSU. ;
*-------------------------------------------------------------------------;
data =DTTOT;
by
SDMVSTRA SDMVPSU;
;
*-------------------------------------------------------------------------;
* Use the PROC RATIO procedure to compute a properly weighted
estimated ;
* ratio of means in
SUDAAN. ;
*-------------------------------------------------------------------------;
setenv DECWIDTH=
5
COLWIDTH= 20 ;
nest SDMVSTRA SDMVPSU;
weight
WTDRD1;
subgroup RIAGENDR;
levels
2 ;
numer D1MCALC;
denom DR1TCALC;
tables
RIAGENDR;
subpopn usedat=
1 /name= "Age
20+ with reliable Day1 recall" ;
rtitle
"Ratios of Means" ;
;
For Subpopulation: Age 20+ with reliable Day1 recall
Ratios of Means
Number of observations read : 9034 Weighted count :286222757
Number of observations skipped : 1088
(WEIGHT variable nonpositive)
Observations in subpopulation : 4448 Weighted count:205284669
Denominator degrees of freedom : 15
Variance Estimation Method: Taylor Series (WR)
by: Variable, Gender - Adjudicated.
-------------------------------------------------------------------------------------------------------
| | | |
| Variable | | Gender - Adjudicated |
| | | Total | male | female |
-------------------------------------------------------------------------------------------------------
| | | | | |
| Calcium (mg)| Sample Size | 4448.00000 | 2135.00000 | 2313.00000 |
| | Weighted Size | 205284668.86499 | 98664010.21534 | 106620658.64965 |
| | Weighted X-Sum | 180677371207.75716 | 98502152044.03422 | 82175219163.72238 |
| | Weighted Y-Sum | 20767042010.48192 | 12051053808.36071 | 8715988202.12121 |
| | Ratio Est. | 0.11494 | 0.12234 | 0.10607 |
| | SE Ratio | 0.00683 | 0.00715 | 0.01133 |
| | Lower 95% Limit | | | |
| | Ratio | 0.10039 | 0.10711 | 0.08192 |
| | Upper 95% Limit | | | |
| | Ratio | 0.12949 | 0.13758 | 0.13021 |
--------------------------------------------------------------------------------------------------------
Highlights from the output include: