***************************************************************************** *The SAS program (HEI2005_NHANES0102.SAS): * * * *This program creates the component and total scores for the HEI-2005. * *The 12 components include: Total Fruit, Whole Fruit, * *Total Vegetables, Dark Green and Orange Vegetables and Legumes, * *Total Grains, Whole Grains, Milk, Meat and Beans, Oils, * *Saturated Fat, Sodium, and * *Calories from Solid Fat, Alcohol, and Added Sugar (SoFAAS). * *Please see readme file at http://www.cnpp.usda.gov/HealthyEatingIndex.htm * *****************************************************************************; /* Libname is the location of the input datasets. See http://www.sas.cc.vt.edu/faqlib/libname.html for more information*/ LIBNAME HEI "C:\"; TITLE 'HEI-2005, NHANES 2001-2002, Age 2+, Reliable Diets, Exclude Pregnant and Lactating Women'; OPTIONS LINESIZE=79; /*Step 1: locate required datasets*/ /*MyPyrEquivDB_v1: From MyPyramid Equivalents Database (from MyPyrEquivDB_v1/data/equiv0102) for USDA Survey Food Codes Version 1.0 CNPPMyPyrEquivDB_v1_WJFRT: CNPP MyPyramid Equivalent Database for Whole Fruit and Fruit Juice drxiff_b: NHANES 2001-2002 individual food intake data in 1 day drxtot_b: NHANES 2001-2002 individual nutrient intake data in 1 day demo_b: NHANES 2001-2002 individual demographic and survey sampling information rhq_b: NHANES 2001-2002 reproductive health questionnaire information */ data MPED; set HEI.MyPyrEquivDB_v1; /*In the HEI-2005, soy beverages are counted as part of the Milk component. Convert the four soy beverage codes in the MPED from M_SOY oz equivalents to D_TOTAL cup equivalents using the following conversion process*/ /*FOODCODE=11310000, MILK, IMITATION, FLUID, SOY BASED (1 cup=244 grams) FOODCODE=11320000, MILK, SOY, READY-TO-DRINK, NOT BABY (1 cup=245 grams) FOODCODE=11321000, MILK, SOY, READY-TO-DRINK, NOT BABY'S, CHOCOLATE (1 cup=240 grams) FOODCODE=11330000, MILK, SOY, DRY, RECONSTITUTED, NOT BABY (1 cup=245 grams)*/ IF FOODCODE=11310000 THEN DO; M_SOY=0; D_TOTAL=ROUND(100*(1/244),.001); END; ELSE IF FOODCODE=11320000 THEN DO; M_SOY=0; D_TOTAL=ROUND(100*(1/245),.001); END; ELSE IF FOODCODE=11321000 THEN DO; M_SOY=0; D_TOTAL=ROUND(100*(1/240),.001); END; ELSE IF FOODCODE=11330000 THEN DO; M_SOY=0; D_TOTAL=ROUND(100*(1/245),.001); END; run; PROC SORT DATA=MPED; BY FOODCODE; run; DATA CNPPMPED_WJFRT; SET HEI.CNPPMyPyrEquivDB_v1_WJFRT; run; PROC SORT DATA=CNPPMPED_WJFRT; BY FOODCODE; run; DATA Food; SET HEI.drxiff_b; FOODCODE=1*DRDIFDCD; /*convert variable name and type*/ if DRDDRSTZ=1; /*reliable dietary recall status*/ RUN; PROC SORT DATA=Food; BY FOODCODE; run; DATA Nutrient (keep=SEQN DRXTKCAL DRXTCARB DRXTSFAT DRXTALCO DRDTSODI); SET HEI.DRXTOT_b; if DRDDRSTZ=1; /*reliable dietary recall status*/ run; PROC SORT DATA=Nutrient; BY SEQN; run; DATA demo (keep=SEQN RIDAGEYR SDDSRVYR RIDPREG WTMEC2YR SDMVPSU SDMVSTRA); SET HEI.demo_b; run; PROC SORT DATA=demo; BY SEQN; run; DATA rhq (keep=SEQN RHQ200); SET HEI.rhq_b; run; PROC SORT DATA=rhq; BY SEQN; run; /*Step 2: Combine required datasets and calculate NHANES 2001-2002 individual food and nutrient intakes*/ /*Please note: The CNPP whole fruit and fruit juice database is only created for NHANES 2001-2002*/ DATA PYR; MERGE MPED(IN=S) CNPPMPED_WJFRT(IN=N); BY FOODCODE; IF S AND N; run; DATA FDPYR; MERGE Food (IN=S) PYR (IN=N); BY FOODCODE; IF S AND N; run; /*Convert NHANES 01-02 individuals' food intake amounts from grams to MyPyramid equivalents*/ DATA FDPYR; SET FDPYR; /* calculate intake for MyPyramid food groups*/ ARRAY PYRVAR F_TOTAL WHOLEFRT V_TOTAL V_DRKGR V_ORANGE LEGUMES G_TOTAL G_WHL D_TOTAL M_MPF M_EGG M_NUTSD M_SOY DISCFAT_OIL DISCFAT_SOL ADD_SUG; DO OVER PYRVAR; PYRVAR=PYRVAR*(DRXIGRMS/100); END; run; PROC SORT DATA=FDPYR; BY SEQN; run; /*Calculate individual's food intake amounts for MyPyramid food groups in 1 day*/ PROC MEANS DATA=FDPYR NOPRINT; BY SEQN; VAR F_TOTAL WHOLEFRT V_TOTAL V_DRKGR V_ORANGE LEGUMES G_TOTAL G_WHL D_TOTAL M_MPF M_EGG M_NUTSD M_SOY DISCFAT_OIL DISCFAT_SOL ADD_SUG; OUTPUT OUT=PYRCALC SUM= ; run; /*Calculate individual's nutrient intake (DRXICARB, carbohydrate; DRXIALCO, alcohol) from beer, wine and distilled spirits, but exclude cooking wine*/ DATA BWLNUT (KEEP=SEQN DRXICARB DRXIALCO DRXILINE THREED); SET food; THREED=INT(FOODCODE/100000); IF (931 <= THREED <= 935); /*alcoholic beverages of beer, wine, and distilled spirits*/ IF FOODCODE=93401300 THEN DELETE; /*Remove cooking wine*/ run; PROC SORT DATA=BWLNUT; BY SEQN DRXILINE; run; /*Identify Added Sugar intake from beer, wine and distilled spirits, but exclude cooking wine*/ DATA BWLPYR (KEEP=SEQN ADD_SUG DRXIGRMS DRXILINE THREED); SET FDPYR; THREED=INT(FOODCODE/100000); IF (931 <= THREED <= 935); /*alcoholic beverages of beer, wine, and distilled spirits*/ IF FOODCODE=93401300 THEN DELETE; /*Remove cooking wine*/ run; PROC SORT DATA=BWLPYR; BY SEQN DRXILINE; run; DATA BEERWINE; MERGE BWLNUT BWLPYR; BY SEQN DRXILINE; run; /*Exclude calories from Added Sugars food group in alcoholic beverages*/ DATA BEERWINE; SET BEERWINE; BY SEQN; SUGGRAM=ADD_SUG*4; /*convert from teaspoons to grams of added sugars=grams of carbohydrate from added sugars*/ NOSCARB=DRXICARB-SUGGRAM; /*subtract grams of carbohydrate from added sugars from the total carbohydrate*/ IF THREED IN (931,932,934) THEN BWCARBC=NOSCARB*4; /*SoFAAS calories from carbohydrate in alcoholic beverages*/ ETHCAL=DRXIALCO*7; /*SoFAAS calories from alcohol (ethanol) in alcoholic beverages*/ run; /*Calculate individual's SoFAAS calories from carbohydrate and alcohol (enthanol) in alcoholic beverages in 1 day*/ PROC MEANS DATA=BEERWINE NOPRINT; BY SEQN; VAR BWCARBC ETHCAL; OUTPUT OUT=BEERWINE SUM=BWCARBC ETHCAL; run; /*Combine all required datasets*/ /*Only include individuals who are age 2 years and older and exclude pregnant and lactating women*/ DATA BOTH; MERGE Nutrient (IN=F) BEERWINE PYRCALC(IN=P) DEMO rhq; BY SEQN; IF F AND P; IF RIDAGEYR >= 2; /*individuals age 2 and older*/ IF RIDPREG=1 THEN DELETE; /*exclude pregnant women*/ IF RHQ200=1 THEN DELETE; /*exclude lactating women*/ run; /*Step 3: Calculate nutrient density per 1000 calories and then calculate HEI-2005 component and total scores*/ /*Please note: MyPyramid equivalent values for total vegetable intake (V_TOTAL) in the HEI-2005 may be different from V_TOTAL in the MPED because legumes may be counted as vegetables or meat in the HEI-2005; and total dairy intake (D_TOTAL) in the HEI-2005 may be different from D_TOTAL in the MPED because soy beverages are counted as milk in the HEI-2005.*/ DATA HEI2005; SET BOTH; BY SEQN; /**Calculate HEI-2005 TOTAL FRUIT component score**/ /*Standard for maximum score is >=0.8 cup equiv/1000 kcal, Maximum score is 5; no Fruit intake, minimum score is zero*/ FRTDEN=F_TOTAL/(DRXTKCAL/1000); HEI1=5*(FRTDEN/.8); IF HEI1 > 5 THEN HEI1=5; IF F_TOTAL=0 THEN HEI1=0; /**Calculate HEI-2005 WHOLE FRUIT component score**/ /*Standard for maximum score is >=0.4 cup equiv/1000 kcal, Maximum score is 5; no Fruit intake, minimum score is zero*/ WHFRDEN=WHOLEFRT/(DRXTKCAL/1000); HEI2=5*(WHFRDEN/.4); IF HEI2 > 5 THEN HEI2=5; IF F_TOTAL=0 THEN HEI2=0; /**Calculate HEI-2005 Total Grains component score**/ /*Standard for maximum score is >=3.0 cup equiv/1000 kcal, Maximum score is 5; no Total Grains intake, minimum score is zero*/ GRNDEN=G_TOTAL/(DRXTKCAL/1000); HEI5=5*(GRNDEN/3.0); IF HEI5 > 5 THEN HEI5=5; /**Calculate HEI-2005 Whole Grains component score**/ /*Standard for maximum score is >=1.5 cup equiv/1000 kcal, Maximum score is 5; no Whole Grains intake, minimum score is zero*/ WGRNDEN=G_WHL/(DRXTKCAL/1000); HEI6=5*(WGRNDEN/1.5); IF HEI6 > 5 THEN HEI6=5; IF G_TOTAL=0 THEN DO; /*no reported Total Grains intake, Total Grains and Whole Grains component scores are zero*/ HEI5=0; HEI6=0; END; /**Calculate HEI-2005 Milk component score**/ /*Standard for maximum score is >=1.3 cup equiv/1000 kcal, Maximum score is 10; no Milk intake, minimum score is zero*/ DAIRYDEN=D_TOTAL/(DRXTKCAL/1000); HEI7=10*(DAIRYDEN/1.3); IF HEI7 > 10 THEN HEI7=10; /**Calculate HEI-2005 Meat and Beans component score**/ /*Standard for maximum score is >=2.5 oz equiv/1000 kcal, Maximum score is 10; no Mean or Beans intake, minimum score is zero*/ ALLMEAT=M_MPF+M_EGG+M_NUTSD+M_SOY; /*Calculate total meat intake from meat, poultry, & fish; egg; nuts and seeds; soy products*/ MBMAX=2.5*(DRXTKCAL/1000); /*Create the Meat and Beans standard*/ /*Legumes intake calculation*/ /*Legumes intake counts as Meat and Beans until the standard is met, then the rest count as Total Vegetables*/ /*(1) If total meat intake is less than the Meat and Beans standard, then: */ IF ALLMEAT < MBMAX THEN DO; MEATLEG=LEGUMES*4; /*Convert cup equivalents of Legumes to oz equivalents of Meat and Beans*/ NEEDMEAT=MBMAX-ALLMEAT; /*(a) all Legumes go to Meat and Beans*/ IF MEATLEG <= NEEDMEAT THEN DO; ALLMEAT=ALLMEAT+MEATLEG; V_TOTAL=V_TOTAL; V_DOL=V_ORANGE+V_DRKGR; END; /*(b) Some Legumes go to Meat and Beans and the rest goes to Total Vegetables*/ ELSE IF MEATLEG > NEEDMEAT THEN DO; EXTRMEAT=MEATLEG-NEEDMEAT; EXTRLEG=EXTRMEAT/4; /*Convert oz equivalents of Meat and Beans from Legumes back to cup equivalents*/ ALLMEAT=ALLMEAT+NEEDMEAT; V_TOTAL=V_TOTAL+EXTRLEG; V_DOL=V_ORANGE+V_DRKGR+EXTRLEG; END; END; /*(2) If total meat intake exceeds the Meat and Beans standard, then all Legumes count as Total Vegetables*/ ELSE IF ALLMEAT >= MBMAX THEN DO; V_TOTAL=V_TOTAL+LEGUMES; V_DOL=V_ORANGE+V_DRKGR+LEGUMES; END; /*Calculate HEI-2005 Meat and Beans component score*/ MEATDEN=ALLMEAT/(DRXTKCAL/1000); HEI8=10*(MEATDEN/2.5); IF HEI8 > 10 THEN HEI8=10; /**Calculate HEI-2005 Total Vegetable component score**/ /*Standard for maximum score is >=1.1 cup equiv/1000 kcal, Maximum score is 5; no Vegetable intake, minimum score is zero*/ VEGDEN=V_TOTAL/(DRXTKCAL/1000); HEI3=5*(VEGDEN/1.1); IF HEI3 > 5 THEN HEI3=5; /**Calculate HEI-2005 Dark Green and Orange Vegetables and Legumes component score**/ /*Standard for maximum score is >=0.4 cup equiv/1000 kcal, Maximum score is 5*/ DGVDEN=V_DOL/(DRXTKCAL/1000); HEI4=5*(DGVDEN/.4); IF HEI4 > 5 THEN HEI4=5; /**Calculate HEI-2005 Oils component score**/ /*Standard for maximum score is >=12 grams/1000 kcal, Maximum score is 10*/ OILDEN=DISCFAT_OIL/(DRXTKCAL/1000); HEI9=10*(OILDEN/12); IF HEI9 > 10 THEN HEI9=10; /**Calculate HEI-2005 Saturated Fat component score**/ /*Standard for maximum score is <=7% total kcal, Maximum score is 10; 10% total kcal, score is 8; >=15% total kcal, minimum score is zero*/ IF DRXTKCAL > 0 THEN PCTSFAT=100*(DRXTSFAT*9)/DRXTKCAL; /*Calculate percent of calories from Saturated Fat*/ IF PCTSFAT >= 15 THEN HEI10=0; ELSE IF PCTSFAT <= 7 THEN HEI10=10; ELSE IF PCTSFAT > 10 THEN HEI10= 8 - ( 8 * (PCTSFAT-10)/5 ); ELSE HEI10= 10 - (2 * (PCTSFAT-7)/3 ); /**Calculate HEI-2005 sodium component score**/ /*Standard for maximum score is <=0.7 grams/1000 kcal, Maximum score is 10; 1.1 grams/1000 kcal, score is 8; >=2.0 grams/1000 kcal, minimum score is zero*/ IF DRXTKCAL > 0 THEN SODDEN=DRDTSODI/(DRXTKCAL/1000); /*Calculate Sodium density (mg/1000 kcal); sodium intake in mg*/ SODMAX=2000; SODMED=1100; SODMIN=700; IF SODDEN >= SODMAX THEN HEI11=0; ELSE IF SODDEN <= SODMIN THEN HEI11=10; ELSE IF SODDEN >= SODMED THEN HEI11= 8 - ( 8 * (SODDEN-SODMED)/(SODMAX-SODMED) ); ELSE HEI11= 10 - (2 * (SODDEN-SODMIN)/(SODMED-SODMIN) ); /**Calculate HEI-2005 Calories from SoFAAS component score**/ /*Standard for maximum score is <=20% total kcal, Maximum score is 20; >=50% total kcal, minimum score is zero*/ /*Calculate SoFAAS Calories from Added sugars, Solid fat, and Alcoholic beverages*/ ADDSUGC=16*ADD_SUG; /*calories from added sugars*/ SOLFATC=DISCFAT_SOL*9; /*calories from solid fat*/ IF ETHCAL < 0 THEN ETHCAL=0; IF BWCARBC < 0 THEN BWCARBC=0; EXFAAS=ADDSUGC+SOLFATC+ETHCAL+BWCARBC; /*total SoFAAS calories as in kcal*/ /*Calculate SoFAAS as in %kcal Note: This results in more than 100% of total caloric intake from SoFAAS in a few cases due to the use of the general factors, 4 kcal/gram of carbohydrate, 9 kcal/gram of fat, and 7 kcal/gram of alcohol*/ IF DRXTKCAL > 0 THEN SOFA_PERC=100*(EXFAAS/DRXTKCAL); SOFAMIN=20; SOFAMAX=50; IF SOFA_PERC >= SOFAMAX THEN HEI12=0; ELSE IF SOFA_PERC <= SOFAMIN THEN HEI12=20; ELSE HEI12= 20 - ( 20* (SOFA_PERC-SOFAMIN) / (SOFAMAX-SOFAMIN) ); /*For individuals with no reported total energy intake for the day, the HEI component and total scores are set to zero*/ IF DRXTKCAL=0 THEN DO; HEI1=0; HEI2=0; HEI3=0; HEI4=0; HEI5=0; HEI6=0; HEI7=0; HEI8=0; HEI9=0; HEI10=0; HEI11=0; HEI12=0; END; /**Calculate HEI-2005 total score**/ /*total HEI-2005 score is the sum of 12 HEI component scores*/ HEI2005=HEI1+HEI2+HEI3+HEI4+HEI5+HEI6+HEI7+HEI8+HEI9+HEI10+HEI11+HEI12; LABEL HEI2005='TOTAL HEI-2005 SCORE' HEI1='HEI COMPONENT TOTAL FRUIT' HEI2='HEI COMPONENT WHOLE FRUIT' HEI3='HEI COMPONENT TOTAL VEGETABLES' HEI4='HEI COMPONENT DARK GREEN & ORANGE VEG & LEGUMES' HEI5='HEI COMPONENT TOTAL GRAINS' HEI6='HEI COMPONENT WHOLE GRAINS' HEI7='HEI COMPONENT MILK' HEI8='HEI COMPONENT MEAT & BEANS' HEI9='HEI COMPONENT OILS' HEI10='HEI COMPONENT SATURATED FAT' HEI11='HEI COMPONENT SODIUM' HEI12='HEI COMPONENT CALORIES FROM SOLID FAT, ALCOHOL & ADDED SUGAR (SoFAAS)'; run; Proc sort data=HEI2005; by SEQN; run; DATA HEI.HEI2005_0102 (KEEP=SEQN HEI1-HEI12 HEI2005); SET HEI2005; BY SEQN; run;