You are on page 1of 5

/* DR1IFF_DECASTRO_JAN07_13.SAS VERSION: 1.

0 (Uploaded 01/07/2013) DESCRIPTION: SAS program for processing NHANES 2007 - 2008 data from the "Dietar y Interview, Individual Foods - First Day" file (DR1IFF). Converts multiple die tary interview records for each NHANES participant into a single record with tot al mass (or energy) consumed in each of an arbitrary number of food groups, as d elineated in the US Department of Agriculture (USDA) food coding scheme (USDA Fo od and Nutrient Database for Dietary Studies, 4.1. 2010. Beltsville, MD: Agricul tural Research Service, Food Surveys Research Group). Although this program is for NHANES 2007 - 2008 data, with reasonable care it is readily generalizable to other NHANES cycles. DETAILS: NHANES participants reported the mass consumed within each USDA food gr oup for the 24-hour period (midnight to midnight) preceding the dietary recall i nterview conducted in-person at the MEC. Data for this 24-hour recall period ar e contained in the NHANES Individual Foods First Day file, which provides a reco rd describing each food, water, or beverage consumed by the subject, including t he mass consumed and eight-digit USDA food code. Standardized hierarchical food groups can be identified from the USDA code, where the first digit represents o ne of nine major food groups, and each subsequent digit represents subgroups of increasing specificity. For each participant, the mass reported consumed in eac h food group was summed so that each participant was represented by a single rec ord describing their dietary intake for the previous 24 hours. Each participant s dietary intake was apportioned over the nine major USDA food groups: milk and m ilk products; meat, poultry, fish, and mixtures; eggs; legumes, nuts, and seeds; grain products; fruits; vegetables; fats, oils, and salad dressings; and sugars , sweets, and beverages. In addition, another food subgroup was distinguished: dark-green leafy vegetables. Dark-green leafy vegetables (USDA food code 721) i s a constituent of the vegetables group (USDA food code 7), so for each particip ant, the mass consumed of dark-green leafy vegetables was subtracted from the ma ss consumed of the vegetables group to avoid double-counting. We distinguished a nother food subgroup: water (not bottled) consumed at home. This subgroup was i dentified when the food code equaled 940 and the subject answered yes to whether w ater (not bottled) was consumed at home (DR1_040Z). Water (not bottled) is a co nstituent of the sugars, sweets, and beverages group (USDA food code 9), so for each participant, the mass consumed at home of water (not bottled) was subtracte d from the mass consumed of the sugars, sweets, and beverages group to avoid dou ble-counting. This approach was utilized in Lau FK, Decastro BR, Mills-Herring L, Tao L, Valen tin-Blasini L, Alwis KU, Blount BC. Urinary perchlorate as a measure of dietary and drinking water exposure in a representative sample of the United States popu lation 2001-2008. J Expo Sci Environ Epidemiol. 2012 Nov 28. doi: 10.1038/jes.2 012.108. [Epub ahead of print] PubMed PMID: 23188482. HELPFUL LINKS: NHANES 2007 - 2008 ^^^^^^^^^^^^^^^^^^ Demographics ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/nhanes/2007-2008/DEMO_E.xpt Body Measures ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/nhanes/2007-2008/BMX_E.xpt Dietary Interview, Individual Foods - First Day ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/nhanes/2007-2008/DR1IFF_E.x pt

USDA ^^^^ USDA Food and Nutrient Database for Dietary Studies, 4.1. 2010. Beltsvil le, MD: Agricultural Research Service, Food Surveys Research Group. http://www.ars.usda.gov/SP2UserFiles/Place/12355000/pdf/fndds/fndds4_doc .pdf What's In The Foods You Eat Search Tool http://reedir.arsnet.usda.gov/codesearchwebapp/(npxzxzzse1zoo5uekw4plnfs )/codesearch.aspx B. Rey de Castro, Sc.D. Statistician Centers for Disease Control Link to email address: http://www.google.com/recaptcha/mailhide/d?k=0163C_GUatO7 C0oMjCAPahHA==&c=T7UhXtt6S1rm-mBBsoyOnTatgLub6SOUnpu8QK83r0k= COPYRIGHT PERMISSION NOTICE AND DISCLAIMER AT END OF FILE */ libname demog XPORT "~\data\NHANES\0708\DEMO_E.xpt" ; libname bmi XPORT "~\data\NHANES\0708\BMX_E.xpt" ; libname iff XPORT "~\data\NHANES\0708\DR1IFF_E.xpt" ; libname out "~\data\NHANES\0708" ;

/* Merge demographic, BMI data */ data _bmi ; merge demog.DEMO_E (keep= SEQN SDMVSTRA SDMVPSU WTMEC2YR SDDSRVYR RIAGE NDR RIDAGEYR RIDRETH1 DMDEDUC2 DMDHREDU DMDHSEDU INDFMPIR ) bmi.BMX_E (keep= SEQN BMXWT BMXBMI in= A) ; by SEQN ; if A ; run ; /* Process data _iff0 merge TX DR1_020 individual foods data */ ; iff.DR1IFF_E (keep= SEQN DR1ILINE DR1DRSTZ DR1DAY DR1CCMNM DR1CCM DR1IFDCD DR1IGRMS DR1IKCAL DR1_040Z ) _bmi (keep= SEQN in= A)

; by SEQN ; if A ; DRXIkGRMS = DR1IGRMS / 1000 ; /* Rescale grams to kilograms */ /* Classify each record by 11 food groups: 9 USDA food groups + 2 subgroups of interest. */ foodGrp11 = . ; if not missing(DR1IFDCD) then do ; /* USDA 9 major food groups: 1st digit of USDA Food Code 1: milk and milk products 2: meat, poultry, fish, and mixtures 3: eggs 4: legumes, nuts, and seeds 5: grain products 6: fruits

7: vegetables 8: fats, oils, and salad dressings 9: sugars, sweets, and beverages */ foodGrp11 = substr(put(DR1IFDCD, 8.) , 1 , 1 ) ; /* Note that double-counting is avoided by placing code for identifying subgroups AFTER the code for identifying major food groups. Basically, the subg roup identifier supersedes the major group identifier. */ /* Add 10th food subgroup: Water, Not Bottled consumed at home */ if substr(put(DR1IFDCD, 8.),1,3)="940" AND DR1_040Z = 1 /* Yes = Home */ then foodGrp11 = 10 ; /* Add 11th food subgroup: Dark-green Leafy Vegetables */ else if substr(put(DR1IFDCD, 8.),1,3)="721" then foodGrp11 = 11 ; end ; /* Add "12th" food category to indicate subjects missing food data */ else if missing(DR1IFDCD) then do ; foodGrp11= 12 ; DRXIkGRMS= -1 ; DR1IKCAL= -1 ; end ; run ; proc sort data= _iff0(keep= SEQN foodGrp11 DRXIkGRMS DR1IKCAL) out= _iff1 ; by SEQN foodGrp11 ; run ; /* Sum mass and energy by subject and USDA food group */ proc means data= _iff1 noprint ; by SEQN foodGrp11 ; var DRXIkGRMS DR1IKCAL ; output out= _iffSum0 (drop= _:) sum= foodKgram foodKcal ; run ; proc sort data= _iffSum0 ; by SEQN foodGrp11 ; run ; /* Transpose summed mass for merge */ proc transpose data= _iffSum0 out= _kgramSum0(drop= _:) prefix= fKgram ; by SEQN ; id foodGrp11 ; var foodKgram ; run ; /* Transpose summed energy for merge */ proc transpose data= _iffSum0 out= _kcalSum0(drop= _:) prefix= fKcal ; by SEQN ; id foodGrp11 ; var foodKcal ;

run ; /* Merge food mass and energy data with demographic, BMI data */ data out.bmi0708 ; merge _bmi(in= A) _kgramSum0 _kcalSum0 ; by SEQN ; if A ; label fKgram1= fKgram2= fKgram3= fKgram4= fKgram5= fKgram6= fKgram7= fKgram8= fKgram9= fKgram10= fKgram11= fKcal1= fKcal2= fKcal3= fKcal4= fKcal5= fKcal6= fKcal7= fKcal8= fKcal9= fKcal10= fKcal11= totKgram= totKcal= fKgWt1= fKgWt2= fKgWt3= fKgWt4= fKgWt5= fKgWt6= fKgWt7= fKgWt8= fKgWt9= fKgWt10= fKgWt11= "Mass: Milk Products [kg]" "Mass: Meat, Poultry, Fish [kg]" "Mass: Eggs [kg]" "Mass: Legumes, Nuts, Seeds [kg]" "Mass: Grain Products [kg]" "Mass: Fruits [kg]" "Mass: Vegetables [kg]" "Mass: Fats, Oils, Salad Dressings [kg]" "Mass: Sugars, Sweets, Beverages [kg]" "Mass: Water (Not Bottled) at Home [kg]" "Mass: Dark-green Leafy Vegetables [kg]" "Energy: Milk Products [kcal]" "Energy: Meat, Poultry, Fish [kcal]" "Energy: Eggs [kcal]" "Energy: Legumes, Nuts, Seeds [kcal]" "Energy: Grain Products [kcal]" "Energy: Fruits [kcal]" "Energy: Vegetables [kcal]" "Energy: Fats, Oils, Salad Dressings [kcal]" "Energy: Sugars, Sweets, Beverages [kcal]" "Energy: Water (Not Bottled) at Home [kcal]" "Energy: Dark-green Leafy Vegetables [kcal]" "Total Mass [kg]" "Total Energy [kcal]" "Mass: Milk Products [kg/kg bw]" "Mass: Meat, Poultry [kg/kg bw]" "Mass: Eggs [kg/kg bw]" "Mass: Legumes, Nuts, Seeds [kg/kg bw]" "Mass: Grain Products [kg/kg bw]" "Mass: Fruits [kg/kg bw]" "Mass: Vegetables [kg/kg bw]" "Mass: Fats, Oils, Salad Dressings [kg/kg bw]" "Mass: Sugars, Sweets, Beverages [kg/kg bw]" "Mass: Water (Not Bottled) at Home [kg/kg bw]" "Mass: Dark-green Leafy Vegetables [kg/kg bw]"

; /* Only for subjects not missing all food data */ array fSum{11,2} fKgram1 - fKgram11 fKcal1 - fKcal11 ; if missing(fKgram12) AND missing(fKcal12) then do ; /* Set missing sums to zero */ do _i=1 to dim2(fSum) ; do _j=1 to dim1(fSum) ; if missing(fSum{_j,_i}) then fSum{_j,_i}= 0 ; end ; end ;

totKgram = sum(of fKgram1 - fKgram11) ; totKcal = sum(of fKcal1 - fKcal11 ) ; end ; /* Compute food mass consumed per kg body weight */ array foodWt{2,11} fKgram1 fKgram2 fKgram3 fKgram4 fKgram5 fKgram6 fKgram7 fKgram8 fKgram9 fKgram10 fKgram11 fKgWt1 fKgWt2 fKgWt3 fKgWt4 fKgWt5 fKgWt6 fKgWt7 fKgWt8 fKgWt9 fKgWt10 fKgWt11 ; do _k= 1 to dim2(foodWt) ; if not missing(foodWt{1,_k}) AND BMXWT> 0 then foodWt{2,_k}= foodWt{1,_k }/BMXWT ; end ; drop _: fKgram12 fKcal12 ; run ; proc sort data= out.bmi0708 ; by SDMVSTRA SDMVPSU ; run ; /* Copyright (c) 2013 B. Rey de Castro, Sc.D. (http://www.google.com/recaptcha/mail hide/d?k=0163C_GUatO7C0oMjCAPahHA==&c=T7UhXtt6S1rm-mBBsoyOnTatgLub6SOUnpu8QK83r0 k=) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in th e Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subj ect to the following conditions: The above copyright notice and this permission notice shall be included in all c opies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI ED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYR IGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WIT H THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */

You might also like