## Task 1c: How to Estimate a Mean Ratio using SUDAAN

This section describes how to use SUDAAN to estimate a mean ratio 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.

### Step 1: Sort Data

This section describes how to use SUDAAN and SAS to estimate mean ratios for all adults and for males and females separately.  The illustrate this, the calcium from milk is divided by the sum of total calcium for each person and these ratios are averaged for each 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.

For this analysis, DAY1RATIO is a variable that was created to represent the ratio of the amount of calcium from milk to the amount of total calcium for each individual on recall Day 1.

### Step 2: Compute Properly Weighted Estimated Mean Ratios

#### Sample Code

*-------------------------------------------------------------------------;
* Use the PROC SORT procedure to sort the data by strata and PSU.         ;
*-------------------------------------------------------------------------;

proc sort data =DTTOT;
by SDMVSTRA SDMVPSU;
run ;

*-------------------------------------------------------------------------;
* Use the PROC DESCRIPT procedure in SUDAAN to compute a properly weighted;
* estimated mean ratio for all persons ages 20+.                          ;
*-------------------------------------------------------------------------;

proc descript data =DTTOT;
setenv decwidth=5 colwidth= 20 ;
nest SDMVSTRA SDMVPSU;
weight WTDRD1;
subgroup RIAGENDR;
levels 2 ;
var DAY1RATIO;
tables RIAGENDR;
subpopn usedat= 1 /name= "Age 20+ with reliable Day1 recall" ;
rtitle "Mean Ratios" ;
run ;

#### Output of Program

```
For Subpopulation: Age 20+ with reliable Day1 recall
Mean Ratios

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)

-----------------------------------------------------------------------------------------------------------
|                 |                  |                                                                    |
| Variable        |                  | Gender - Adjudicated                                               |
|                 |                  | Total                | male                 | female               |
-----------------------------------------------------------------------------------------------------------
|                 |                  |                      |                      |                      |
| DAY1RATIO       | Sample Size      |           4447.00000 |           2134.00000 |           2313.00000 |
|                 | Weighted Size    |      205081760.39614 |       98461101.74649 |      106620658.64965 |
|                 | Total            |       15659108.92268 |        8212141.01881 |        7446967.90388 |
|                 | Lower 95% Limit  |                      |                      |                      |
|                 |  Total           |       11604497.09333 |        6113268.12078 |        5227756.20478 |
|                 | Upper 95% Limit  |                      |                      |                      |
|                 |  Total           |       19713720.75203 |       10311013.91683 |        9666179.60298 |
|                 | Mean             |              0.07636 |              0.08340 |              0.06985 |
|                 | SE Mean          |              0.00469 |              0.00473 |              0.00686 |
|                 | Lower 95% Limit  |                      |                      |                      |
|                 |  Mean            |              0.06635 |              0.07333 |              0.05523 |
|                 | Upper 95% Limit  |                      |                      |                      |
|                 |  Mean            |              0.08636 |              0.09348 |              0.08446 |
----------------------------------------------------------------------------------------------------------
```

Highlights from the output include:

• The mean is .076 (with a standard error of .005).  For males, it is .083 (.005), and for females, .070 (.007).
• Note that these results are different from the ratio of means, and consider that for many purposes, the ratio of means is preferable to the mean 1-day ratio.   For example, it has been shown the ratio of means is often the better estimate of the mean usual ratio.
• Also note that this analysis has only 4,447 persons rather than the 4,448 shown in the ratio of means analysis.  That is because one man did not have any calcium and therefore the ratio (0/0) is undefined.
• In this output, the Weighted Size is the sum of the weights for the observations used in the analysis, which is the denominator for computing the mean.  The Total, which is the numerator for computing the mean, is the weighted sum of the ratio of reported calcium from milk to the reported total calcium on a given day.  These values, as well as their respective confidence limits, are part of the default output and are not generally relevant to these types of analyses when used alone. Close Window to return to module page.