# Usual Dietary Intakes: SAS Macros for Fitting Multivariate Measurement Error Models & Estimating Multivariate Usual Intake Distributions

The following SAS macros can be used to create a multivariate usual intake distribution for multiple dietary components that are consumed nearly every day or episodically. A SAS macro for performing balanced repeated replication (BRR) variance estimation is also included.

- MULTIVAR_MCMC Macro: fits a multivariate measurement error model that can include episodically consumed dietary components and non-episodically consumed dietary components.
- STD_COV_BOXCOX24HR_CONDAY_MINAMT Macro: prepares input data for the MULTIVAR_MCMC macro by standardizing continuous covariates, transforming and standardizing reported nonzero amounts (e.g. from 24-hour recalls), and creating other variables needed for the MULTIVAR_MCMC macro.
- MULTIVAR_DISTRIB Macro: uses parameter estimates from the MULTIVAR_MCMC macro to generate a multivariate Monte Carlo distribution of usual intakes of multiple dietary components.
- BRR_PVALUE_CI Macro: performs balanced repeated replication (BRR) variance estimation and calculates standard errors, confidence intervals and p-values for user-specified parameters of interest.

Documentation for these macros is provided in the User's Guide: SAS Macros for Fitting Multivariate Measurement Error Models and Estimating Multivariate Usual Intake Distributions [PDF - 157 KB]. Applications of these macros are described in Zhang et al., 2011a, Zhang et al., 2011b, and Guenther et al. 2014

The following sample programs illustrate the use of these macros for creating a multivariate Monte Carlo distribution of usual intakes and subsequent calculation of mean usual HEI–2010 scores using NHANES 2003-04 data for smokers, age 20 and older. The first example (1a) uses a dataset based on NHANES 2003-04 data, with a small set of variables used to illustrate the method, and the second example (1b) uses results stored from the first example. The third example (1c) illustrates balanced repeated replication (BRR) variance estimation and calculations for t-tests comparing mean usual HEI–2010 scores for nonsmokers and smokers, age 20 and older. For convenience, this example (1c) uses an input data set that includes mean usual HEI–2010 scores for nonsmokers and smokers and includes the replicated results needed for BRR variance estimation.

- Sample programs and output:
- Example 1a [ZIP - 31 KB] illustrates the use of the STD_COV_BOXCOX24HR_CONDAY_MINAMT and MULTIVAR_MCMC macros to fit a multivariate measurement error model for the dietary components in the Healthy Eating Index – 2010 (HEI–2010) using NHANES 2003-04 data for smokers, age 20 and older.
- Example 1b [ZIP - 14 KB] illustrates the use of the MULTIVAR_DISTRIB macro to generate a multivariate Monte Carlo distribution of usual intakes and illustrates subsequent calculations of mean usual HEI–2010 scores using NHANES 2003-04 data for smokers, age 20 and older.
- Example 1c [ZIP - 11 KB] illustrates the use of the BRR_PVALUE_CI macro to calculate the BRR standard errors for the mean usual HEI–2010 scores for nonsmokers and smokers and perform t-tests comparing mean usual HEI–2010 scores for nonsmokers and smokers.

- Analytic datasets for examples [ZIP - 771 KB]
- Details of dataset contents for examples 1a-b:
- Details of dataset contents for example 1c