## Task 1d: How to Estimate a Mean Ratio using SAS

This section describes how to use SAS 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.

#### Sample Code

*-------------------------------------------------------------------------;
* Use the PROC SURVEYMEANS procedure in SAS to compute a properly weighted;
* estimated mean ratio for all persons ages 20+ and by gender.            ;
*-------------------------------------------------------------------------;
* Run analysis for overall subpopulation of interest;

proc surveymeans data=DTTOT;
where usedat=1 ;
strata SDMVSTRA;
cluster SDMVPSU;
weight WTDRD1;
var DAY1RATIO;
title " Mean Ratio -- All Persons ages 20+" ;
run ;

*-------------------------------------------------------------------------;
* Use the PROC SORT procedure to sort the data by gender.                 ;
*-------------------------------------------------------------------------;

proc sort data =DTTOT;
by RIAGENDR;
run ;

* Run analysis for by gender within subpopulation of interest;

proc surveymeans data=DTTOT;
where usedat=1 ;
strata

SDMVSTRA;
cluster SDMVPSU;
weight WTDRD1;
var DAY1RATIO;
by RIAGENDR;
title " Mean Ratios -- by Gender" ;
run ;

#### Output of Program

```
Mean Ratio -- All Persons ages 20+

Data Summary

Number of Strata                  15
Number of Clusters                30
Number of Observations          4448
Sum of Weights             205284669

Statistics

Std Error       Lower 95%       Upper 95%
Variable                N            Mean         of Mean     CL for Mean     CL for Mean
-----------------------------------------------------------------------------------------
day1ratio            4447        0.076355        0.004692        0.066355        0.086356
-----------------------------------------------------------------------------------------

Mean Ratios -- by Gender

Data Summary

Number of Strata                  15
Number of Clusters                30
Number of Observations          2135
Sum of Weights            98664010.2

Statistics

Std Error       Lower 95%       Upper 95%
Variable                N            Mean         of Mean     CL for Mean     CL for Mean
-----------------------------------------------------------------------------------------
day1ratio            2134        0.083405        0.004729        0.073326        0.093484
-----------------------------------------------------------------------------------------

The SURVEYMEANS Procedure

Data Summary

Number of Strata                  15
Number of Clusters                30
Number of Observations          2313
Sum of Weights             106620659

Statistics

Std Error       Lower 95%       Upper 95%
Variable                N            Mean         of Mean     CL for Mean     CL for Mean
-----------------------------------------------------------------------------------------
day1ratio            2313        0.069845        0.006857        0.055231        0.084460
-----------------------------------------------------------------------------------------
```

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 most intents and purposes, the ratio of means is preferred over the mean 1-day 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.