Task 1b: How to Estimate Mean Food Intakes Using SAS

This section describes how to use SAS to estimate mean food intakes along with standard errors.  To illustrate this, consumption of milk is used as an example.  As explained in the key concepts section, there are different ways to group foods for analysis, and so it is with examining “milk” intakes.  One way is to consider only fluid milk reported separately—not as part of a combination—and another is to account for all milk and milk products—including milk, yogurt and cheese—whether reported separately or as part of a combination or mixture.  In the programs that follow, consumption of fluid milk not in combination, measured in grams, and consumption of all milk and milk products, measured in cup equivalents, are used as examples. 

The following analyses are for children ages 6-11, and mean intakes are estimated among users.  Such estimates answer the question: on average, what quantity is consumed in a given day by users of the food?  Analysts interested in per capita consumption (that is, including zeroes for non-consumers) would need to specify that missing values should be set to zero.  See full program under Additional Resources for note about this.


Step 1: Compute Properly Weighted Estimated Means and Standard Errors

Sorting is not a necessary first step in SAS, as it is in SUDAAN. Therefore, properly weighted estimated means and standard errors can be obtained via a single SAS procedure, PROC SURVEYMEANS. 

In the sample below, the NOBS, MEAN, and STDERR options in the PROC SURVEYMEANS statement request that the number of observations, the estimated mean, and its estimated standard error, respectively, be printed for each analysis variable.  The DOMAIN statement designates the combination of variables required to obtain separate estimates by gender (RIAGENDR) within the cohort of interest (INCOH).  INCOH is a variable that has value 1 if the individual is “in the cohort” and zero otherwise.  Here, children ages 6 to 11 with complete and reliable recall data have INCOH=1.  The FORMAT statement controls how levels of the RIAGENDR variable are printed on the output.  As in the SUDAAN example above, the weight variable being used is for the dietary recall Day 1 subsample (WTDRD1). 


Estimating Mean Intake of Milk as a Beverage, in Grams, and Intake of Total Milk and Milk Products, in Cup Equivalents

Sample Code

* Use the PROC SURVEYMEANS procedure in SAS to compute properly weighted  ;
* estimated means and standard errors                                     ;
*                                                                         ;
* To properly perform a subdomain analysis, form a 2-way table of INCOH   ;
* by RIAGENDR.  In this example, the statistics of interest are those     ;
* where INCOH=1 in the table.                                             ;

proc surveymeans nobs mean stderr data = CALCMILK;
    strata SDMVSTRA;
    cluster SDMVPSU;
    domain INCOH*RIAGENDR;
    var MILK0 D_TOTAL;
    weight WTDRD1;
    format RIAGENDR GENDER. ;
    title1 "Estimated daily intake of fluid milk drunk by itself as a beverage;
           and of total milk and milk products" ;
    title2 "children age 6-11, WWEIA, NHANES 2003-2004 - using SAS" ; run ;


Output of Program

Estimated daily intake of fluid milk drunk by itself as a beverage;       
children age 6-11, WWEIA, NHANES 2003-2004 - using SAS
                          The SURVEYMEANS Procedure

                                 Data Summary 

             Number of Strata                              15             
             Number of Clusters                            30             
             Number of Observations                     10122             
             Number of Observations Used                 9034             
             Number of Obs with Nonpositive Weights      1088             
             Sum of Weights                         286222757  

                                Statistics                                                                Std Error
Variable  Label                                                                    N            Mean       of Mean ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ

MILK0     Fluid milk (g) consumed outside of a combination for consumers          2332      451.443365    12.905530
D_TOTAL   Total number of milk group (milk, yogurt & cheese) cupequivalents       8273        1.761007     0.048017
                   Domain Analysis: Gender - Adjudicated*INCOH
Gender -                                                                                                       Std Error Adjudic.  INCOH Variable Label                                                               N       Mean        of Mean ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ Male        0   MILK0    Fluid milk (g) consumed outside of a combination for consumers     1034   503.310228   22.624207                 D_TOTAL  Total number of milk group (milk, yogurt & cheese) cupequivalents  3615     1.916645    0.059658             1   MILK0    Fluid milk (g) consumed outside of a combination for consumers      143   395.289004   45.893677                 D_TOTAL  Total number of milk group (milk, yogurt & cheese) cupequivalents   422     2.595515    0.162629 Female      0   MILK0    Fluid milk (g) consumed outside of a combination for consumers      984   426.001838   13.414503                 D_TOTAL  Total number of milk group (milk, yogurt & cheese) cupequivalents  3758     1.500916    0.048613             1   MILK0    Fluid milk (g) consumed outside of a combination for consumers      171   305.434366   27.785526                 D_TOTAL  Total number of milk group (milk, yogurt & cheese) cupequivalents   478     2.133974    0.141756 ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ

Highlights from the output include:



It is important to note that the analysis above was conducted using only children ages 6-11 who were consumers of milk as a beverage. If, however all members (i.e. consumers and non-consumers) of the selected age group were included (total n = 900; 422 males and 478 females), then the average amounts would be lower. For males, the mean milk intake would be 145 gm and for females, it would be 136 gm (see the full Milk program in the Additional Resources section for example code). These means represent the per capita consumption.

close window icon Close Window to return to module page.