Task 4b: How to Estimate Total Nutrient Intakes Using SAS

This section describes how to use SAS to estimate mean nutrient intakes from all sources – that is, from foods, beverages, and supplements – along with standard errors.  To illustrate this, consumption of calcium by adults ages 20 and older is used as an example.

 

Step 1: Sort Data

 Sort the previously saved datasets by SEQN and merge them, keeping data only for those individuals from the food analysis data set.  During the MERGE step, create a variable called TOTCALC that is the sum of the 24-hour recall and supplemental calcium average values.

 

Step 2: Compute Properly Weighted Estimated Means and Standard Errors

Use the PROC SURVEYMEANS procedure to estimate mean intakes of calcium from diet, from supplements and from their combination using complex survey design factors (e.g. strata and PSUs). 

The WHERE clause tells SAS to subset the input data set and only include individuals ages 20 and older.  We could have defined an “in cohort” variable and used it as an additional variable in the domain statement as in other analyses in this course, but because NHANES is designed to be representative of all individuals ages 20 and older, we can use this shortcut approach.

 

Use SAS to Estimate Mean Intake of Calcium, in Milligrams, from Diet, Supplements, and Their Combination among Females Ages 20 Years and older

Sample Code

*-------------------------------------------------------------------------;
* Sort the previously-saved data sets by SEQN and merge them, keeping     ;
* data only for those individuals from the food analysis data set.        ;
*-------------------------------------------------------------------------;

proc sort data =NH.CALCMILK out =CALC24(keep=SEQN WTDRD1 DR1TCALC RIDAGEYR);
    by SEQN;
run

proc sort data =NH.DEMOOSTS out =CALCDS(keep=SEQN SDMVSTRA SDMVPSU RIAGENDR
    AGEGRP DAILYAVG);
    by SEQN;
run ;

data CALCTD;
    merge CALC24(in =IN24) CALCDS;
    by SEQN;
    < if IN24;
    * Create a variable that is the sum of 24HR and supplemental calcium;
    TOTCALC= DR1TCALC + DAILYAVG;
    * Use the LABEL statement to provide descriptive labels;
    label DR1TCALC= 'Calcium (mg) from food and beverage sources on first 24HR'
        DAILYAVG= 'Calcium (mg) from dietary supplements (Estimated daily average)'
        TOTCALC= 'Estimated total calcium intake on day of first 24HR from all sources'
run ;

*-------------------------------------------------------------------------;
* Use the PROC SURVEYMEANS procedure to estimate mean intakes of calcium  ;
* from diet, from supplements, and from their combination  using complex  ;
* survey design factors (e.g. strata and PSU)                             ;
*-------------------------------------------------------------------------;

proc surveymeans nobs mean stderr data = CALCTD(where=(RIDAGEYR >= 20 ));
  strata SDMVSTRA;
  cluster SDMVPSU;
  domain RIAGENDR*AGEGRP;
  var DR1TCALC DAILYAVG TOTCALC;
  weight WTDRD1;   
  format RIAGENDR GENDER. AGEGRP AGEGRP. ;
run ;

 

Output of Program

			
			Data Summary

Number of Strata                                  15
Number of Clusters                                30
Number of Observations                          5041
Number of Observations Used                     4448
Number of Obs with Nonpositive Weights           593
Sum of Weights                             205284669

                          		       Statistics
                                                                                                      Std Error
Variable   Label                                                                 N           Mean       of Mean
---------------------------------------------------------------------------------------------------------------
DR1TCALC   Calcium (mg) from food and beverage sources on first 24HR            4448     880.130855    16.722099
DAILYAVG   Calcium (mg) from dietary supplements (Estimated daily average)      4438     195.756197    12.013442
TOTCALC    Estimated total calcium intake on day of first 24HR from all sources 4438    1077.855751    26.089415
----------------------------------------------------------------------------------------------------------------


                           Domain Analysis
 
Gender -     Age of                                               Std Error
Adjudicated  subject   Variable  	 N             Mean             of Mean
----------------------------------------------------------------------------
  Male         20-39     DR1TCALC   709        1139.278271       31.958119
                         DAILYAVG   708          57.289018        6.022608
                         TOTCALC    708        1199.794452       34.012767
               40-59     DR1TCALC   615         952.019669       32.736675
                         DAILYAVG   612         155.669226       15.930999
                         TOTCALC    612        1110.782568       37.304728
               >= 60     DR1TCALC   811         825.843492       28.266203
                         DAILYAVG   810         200.238668       15.845799
                         TOTCALC    810        1026.113669       38.492539
  Female       20-39     DR1TCALC   827         828.993076       32.424725
                         DAILYAVG   824         128.043456       15.980951
                         TOTCALC    824         959.569450       39.133256
               40-59     DR1TCALC   636         746.093354       26.667954
                         DAILYAVG   636         278.951411       28.043083
                         TOTCALC    636        1025.044765       48.354061
               >= 60     DR1TCALC   850         719.487424       18.471985
                         DAILYAVG   848         426.884605       23.980534
                         TOTCALC    848        1148.799863       28.292083
---------------------------------------------------------------------------  

 

Highlights from the output include:

 

close window icon Close Window to return to module page.