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.

 

 

Use SAS to Estimate Mean Contribution of milk to Calcium Intake for All Adults, Males, and Females, Ages 20 Years and Older

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                                 

Gender - Adjudicated=male    
                             
            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
-----------------------------------------------------------------------------------------
                             
Gender - Adjudicated=female  
                             
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:

 

close window icon Close Window to return to module page.