title ‘SAS program to estimate fruit/veg/legume from screener’; filename tstdat **insert file name for dsq data**; *Read in and format data; proc format; value $didfmt /* Applies to all *_did variables */ 'A'='Yes' 'B'='No' 'C'="Don't Know" other="Missing" ; value $unitsfmt /* Applies to all *_units variables */ 'A'="PerDay" 'B'="perWeek" 'C'="PerMonth" 'E'="Don't know" other="Missing" ; value $milkchoicefmt /* Applies to the milk_choice variable */ "A"="Whole or regular milk" "B"="2% fat or reduced-fat milk" "C"="1%, 1/2%, or low-fat milk" "D"="Fat-free, skim or nonfat milk" "E"="Soy milk" "F"="Other" other="Missing" ; value $cerealchoicefmt /* Applies to the cereal_1_choice and cereal_2_choice variables */ "A"="100% Bran" "B"="100% Low Fat Natural Granola" "C"="100% Natural Cereal" "D"="100% Natural Cereal, with oats, honey and raisins" "E"="100% Natural Granola, Oats & Honey" "F"="100% Natural Wholegrain Cereal with raisins, lowfat" "G"="All-Bran" "H"="All-Bran Bran Buds" "I"="All-Bran with Extra Fiber" "J"="Alpen" "K"="Alpha-Bits" "L"="Alpha-Bits with marshmallows" "M"="Amaranth Flakes" "N"="Apple Jacks" "O"="Apple Zaps" "P"="Apple Zings, Malt-O-Meal" "Q"="Banana Nut Crunch Cereal" "R"="Barley" "S"="Basic 4" "T"="Berry Colossal Crunch, Malt-O-Meal" "U"="Blueberry Morning" "V"="Booberry" "W"="Bran" "X"="Bran Buds" "Y"="Bran flakes" "Z"="Bran, Nabisco" "AA"="Branola" "AB"="Brown Sugar Bliss" "AC"="Buckwheat groats" "AD"="Bulgur" "AE"="Cap'n Crunch" "AF"="Cap'n Crunch's Christmas Crunch" "AG"="Cap'n Crunch's Crunch Berries" "AH"="Cap'n Crunch's Oops! ChocoDonuts" "AI"="Cap'n Crunch's Peanut Butter Crunch" "AJ"="Cheerios" "AK"="Cheerios, Apple Cinnamon" "AL"="Cheerios, Berry Burst" "AM"="Cheerios, Berry Burst Strawberry" "AN"="Cheerios, Berry Burst Triple Berry" "AO"="Cheerios, Berry Burst, Cherry Vanilla" "AP"="Cheerios, Berry Burst, Strawberry Banana" "AQ"="Cheerios, Frosted" "AR"="Cheerios, Honey Nut" "AS"="Cheerios, Multi Grain" "AT"="Cheerios, Team" "AU"="Cheerios, Yogurt Burst, Strawberry" "AV"="Cheerios, Yogurt Burst, Vanilla" "AW"="Cheese grits" "AX"="Chex" "AY"="Chex Morning Mix Banana Nut" "AZ"="Chex Morning Mix Cinnamon" "BA"="Chex Morning Mix Fruit & Nut" "BB"="Chex Morning Mix Honey Nut" "BC"="Chex, Bran" "BD"="Chex, Corn" "BE"="Chex, Honey Nut" "BF"="Chex, Multi-Bran" "BG"="Chex, Rice" "BH"="Chex, Wheat" "BI"="Chocolate frosted cereal" "BJ"="Cinnamon Cluster Raisin Bran" "BK"="Cinnamon Crunch Crispix" "BL"="Cinnamon Grahams Cereal" "BM"="Cinnamon Marshmallow Scooby Doo!" "BN"="Cinnamon Toast Crunch" "BO"="Cinnamon Toast Crunch, Reduced Sugar" "BP"="Coco-Roos, Malt-O-Meal" "BQ"="Cocoa Blasts" "BR"="Cocoa Comets" "BS"="Cocoa Dyno Bites, Malt-O-Meal" "BT"="Cocoa Krispies" "BU"="Cocoa Pebbles" "BV"="Cocoa Puffs" "BW"="Cocoa Puffs, Reduced Sugar" "BX"="Cocoa Wheats" "BY"="Complete Bran Flakes" "BZ"="Complete Oat Bran Flakes" "CA"="Complete Wheat Bran Flakes" "CB"="Cookie-Crisp (all flavors)" "CC"="Corn Bursts, Malt-O-Meal" "CD"="Corn Flakes, Kellogg's" "CE"="Corn Pops" "CF"="Corn Puffs" "CG"="Corn flakes" "CH"="Corn flakes, low sodium" "CI"="Cornmeal mush" "CJ"="Count Chocula" "CK"="Cracklin' Oat Bran" "CL"="Cranberry Almond Crunch Cereal" "CM"="Cream of Rice" "CN"="Cream of Rye" "CO"="Cream of Wheat" "CP"="Crisp Crunch" "CQ"="Crispix" "CR"="Crispy Brown Rice Cereal" "CS"="Crispy Rice" "CT"="Crispy Rice, Malt-O-Meal" "CU"="Crispy Wheats'N Raisins" "CV"="Crunchy Corn Bran" "CW"="Disney Cereal" "CX"="Disney Hunny B's" "CY"="Disney Mickey's Magix" "CZ"="Disney Mud & Bugs" "DA"="Ener-G Pure Rice Bran" "DB"="Familia" "DC"="Farina" "DD"="Fiber 7 Flakes" "DE"="Fiber One" "DF"="Frankenberry" "DG"="French Toast Crunch" "DH"="Froot Loops" "DI"="Frosted Flakes, Kellogg's" "DJ"="Frosted Flakes, Malt-O-Meal" "DK"="Frosted Fruit Rings" "DL"="Frosted Mini Spooners, Malt-O-Meal" "DM"="Frosted Mini Wheats" "DN"="Frosted Shredded Wheat" "DO"="Frosted Wheat Bites" "DP"="Frosted cereal, with marshmallows" "DQ"="Frosted corn flakes" "DR"="Frosted flakes" "DS"="Frosted rice" "DT"="Frosty O's" "DU"="Fruit & Fibre (fiber)" "DV"="Fruit & Fibre (fiber) with Dates, Raisins and Walnuts" "DW"="Fruit & Fibre (fiber) with Peaches, Raisins, Almonds, and Oat Clusters" "DX"="Fruit Harvest" "DY"="Fruit Harvest Apple Cinnamon" "DZ"="Fruit Harvest Strawberry Blueberry" "EA"="Fruit Loops" "EB"="Fruit Rings" "EC"="Fruit Whirls" "ED"="Fruit and Cream Oatmeal" "EE"="Fruity Dyno Bites, Malt-O-Meal" "EF"="Fruity Pebbles" "EG"="Golden Crisp" "EH"="Golden Grahams" "EI"="Golden Puffs, Malt-O-Meal" "EJ"="Granola" "EK"="Granola, homemade" "EL"="Granola, lowfat" "EM"="Granola, lowfat, Kellogg's" "EN"="Granola, lowfat, with Raisins, Kellogg's" "EO"="Grape Nut O's" "EP"="Grape-Nuts" "EQ"="Grape-Nuts Flakes" "ER"="Great Grains Crunchy Pecan Whole Grain Cereal" "ES"="Great Grains, Raisins, Dates, and Pecans Whole Grain Cereal" "ET"="Grits" "EU"="Harina de maize con leche" "EV"="Harmony Vanilla Almond Oats" "EW"="Healthy Choice" "EX"="Honey Bunches of Oat Honey Roasted" "EY"="Honey Bunches of Oat with Strawberry" "EZ"="Honey Bunches of Oats" "FA"="Honey Bunches of Oats with Almonds" "FB"="Honey Buzzers, Malt-O-Meal" "FC"="Honey Crisp Corn Flakes" "FD"="Honey Crunch Corn Flakes" "FE"="Honey Graham Squares, Malt-O-Meal" "FF"="Honey Nut Clusters" "FG"="Honey Nut Heaven" "FH"="Honey Nut Shredded Wheat" "FI"="Honey Smacks" "FJ"="Honeycomb" "FK"="Honeycomb, strawberry" "FL"="Instant Grits, all flavors" "FM"="Jenny O's" "FN"="Just Right" "FO"="Just Right with Fruit & Nut" "FP"="Kaboom" "FQ"="Kasha" "FR"="Kashi" "FS"="Kashi GOLEAN" "FT"="Kashi Good Friends" "FU"="Kashi Good Friends Cinna-Raisin Crunch" "FV"="Kashi Heart to Heart Cereal" "FW"="Kashi Honey Puffed" "FX"="Kashi Medley" "FY"="Kashi Organic Promise" "FZ"="Kashi Pilaf" "GA"="Kashi Pillows" "GB"="Kashi Seven in the Morning" "GC"="Kashi, Puffed" "GD"="Kix" "GE"="Kix, Berry Berry" "GF"="Life (plain and cinnamon)" "GG"="Lucky Charms" "GH"="Lucky Charms, Berry" "GI"="Lucky Charms, Chocolate" "GJ"="Magic Stars" "GK"="Malt-O-Meal" "GL"="Malt-O-Meal, chocolate" "GM"="Maltex" "GN"="Marshmallow Mateys, Malt-O-Meal" "GO"="Marshmallow Safari" "GP"="Masa harina" "GQ"="Maypo" "GR"="Millet" "GS"="Millet, puffed" "GT"="Mini-Wheats" "GU"="Mini-Wheats Frosted Bite Size" "GV"="Mini-Wheats Frosted Original" "GW"="Mini-Wheats Frosted Raisin" "GX"="Mini-Wheats Frosted Strawberry" "GY"="Mother's Natural Foods Cereal, Quaker" "GZ"="Muesli" "HA"="Muesli(x)" "HB"="Multigrain Oatmeal" "HC"="Multigrain cereal" "HD"="Natural Bran Flakes" "HE"="Nature Valley Granola" "HF"="Nature Valley Granola, with fruit and nuts" "HG"="Nesquik" "HH"="Nestum" "HI"="Nu System Cuisine Toasted Grain Circles" "HJ"="Nutri-Grain" "HK"="Nutri-Grain Golden Wheat and Raisin" "HL"="Nutty Nuggets" "HM"="OS" "HN"="Oat Bran Cereal, Quaker" "HO"="Oat Bran Flakes, Health Valley" "HP"="Oat bran cereal" "HQ"="Oat bran uncooked" "HR"="Oat cereal" "HS"="Oat flakes" "HT"="Oatmeal" "HU"="Oatmeal Crisp" "HV"="Oatmeal Crisp with Almonds" "HW"="Oatmeal Crisp, Apple Cinnamon" "HX"="Oatmeal Crisp, Raisin" "HY"="Oatmeal Squares" "HZ"="Oatmeal Swirlers" "IA"="Oats, raw" "IB"="Oh's" "IC"="Oh's, Apple Cinnamon" "ID"="Oh's, Fruitangy" "IE"="Oh's, Honey Graham" "IF"="Old Wessex Irish Style Oatmeal" "IG"="Optimum Slim, Nature's Path" "IH"="Optimum, Nature's Path" "II"="Oreo O's Cereal" "IJ"="Peanut Butter Toast Crunch" "IK"="Polenta" "IL"="Product 19" "IM"="Puffed Rice, Malt-O-Meal" "IN"="Puffed Wheat, Malt-O-Meal" "IO"="Quaker Dinosaur Eggs oatmeal" "IP"="Quaker Fruit and Cream Oatmeal" "IQ"="Quaker Instant Grits, all flavors" "IR"="Quaker Multigrain Oatmeal" "IS"="Quaker Oatmeal Express" "IT"="Quaker Oatmeal Nutrition for Women" "IU"="Quaker Oatmeal Squares" "IV"="Quisp" "IW"="Raisin Bran Crunch" "IX"="Raisin Bran, Kellogg's" "IY"="Raisin Bran, Post" "IZ"="Raisin Nut Bran" "JA"="Raisin bran" "JB"="Reese's Peanut Butter Puffs" "JC"="Rice Krispies" "JD"="Rice Krispies, Frosted" "JE"="Rice Krispies, Treats Cereal" "JF"="Rice bran, uncooked" "JG"="Rice cereal" "JH"="Rice flakes" "JI"="Rice polishings" "JJ"="Rice, puffed" "JK"="Roman Meal" "JL"="Seven-grain Cereal" "JM"="Seven-grain cereal" "JN"="Shredded Wheat" "JO"="Shredded Wheat 'N Bran" "JP"="Shredded Wheat Spoon Size" "JQ"="Shredded Wheat, 100%" "JR"="Shredded Wheat, Original" "JS"="Smacks" "JT"="Smart Start" "JU"="Smorz" "JV"="Special K" "JW"="Special K Fruit & Yogurt" "JX"="Special K Low Carb Lifestyle Protein Plus" "JY"="Special K Red Berries" "JZ"="Special K Vanilla Almond" "KA"="Strawberry Squares" "KB"="Sun Country 100% Natural Granola, with Almonds" "KC"="Sweet Crunch" "KD"="Sweet Puffs" "KE"="Tasteeos" "KF"="Toasted Cinnamon Twists, Malt-O-Meal" "KG"="Toasted Oatmeal Cereal" "KH"="Toasted Oatmeal, Honey Nut" "KI"="Toasted oat cereal" "KJ"="Toasties" "KK"="Toasty O's, Apple Cinnamon, Malt-O-Meal" "KL"="Toasty O's, Honey and Nut, Malt-O-Meal" "KM"="Toasty O's, Malt-O-Meal" "KN"="Tony's Cinnamon Crunchers" "KO"="Tootie Fruities, Malt-O-Meal" "KP"="Total" "KQ"="Total Brown Sugar & Oats" "KR"="Total Corn Flakes" "KS"="Total Instant Oatmeal" "KT"="Total Raisin Bran" "KU"="Trix" "KV"="Trix, Reduced Sugar" "KW"="Uncle Sam's Hi Fiber Cereal" "KX"="Under Cover Bears" "KY"="Waffle Crisp" "KZ"="Weetabix Whole Wheat Cereal" "LA"="Wheat Hearts" "LB"="Wheat bran, unprocessed (miller's bran)" "LC"="Wheat cereal" "LD"="Wheat germ" "LE"="Wheat germ, with sugar and honey" "LF"="Wheat, puffed" "LG"="Wheat, puffed, presweetened with sugar" "LH"="Wheatena" "LI"="Wheaties" "LJ"="Wheaties Energy Crunch" "LK"="Wheaties Raisin Bran" "LL"="Whole wheat cereal" "LM"="Whole wheat, cracked" "LN"="Zoom" "LO"="Other" other="Missing" ; data dsq; infile tstdat missover lrecl=300; length cereal_1_choice $ 3; length cereal_2_choice $ 3; input @1 study_id 12. @13 respondent_id $30. @43 status_date YYMMDD8. @51 Q1AGE 3. @54 Q2SEX $1. @55 cereal_did $1. /* Cereal Frequency Did you eat any hot or cold cereals? */ @56 cereal_1_freq $4. /* Cereal Frequency How often did you eat hot or cold cereals? */ @60 cereal_1_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @61 cereal_1_choice $3. /* Cereal Choice 1 What kind of cereal did you usually eat?  Pick one. */ @64 cereal_1_other $char25. /* Cereal Choice 1 You selected Other for cereal. What other cereal was this? */ @89 cereal_2_did $1. /* Cereal Choice 1 Was there another cereal that you usually ate? */ @90 cereal_2_choice $3. /* Cereal Choice 2 What second kind of cereal did you usually eat?  Pick one. */ @93 cereal_2_other $char25. /* Cereal Choice 2 You selected Other for cereal. What other cereal was this? */ @118 milk_did $1. /* Milk Did you have any milk (either to drink or on cereal)? */ @119 milk_freq $4. /* Milk How often did you have any milk (either to drink or on cereal)? */ @123 milk_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @124 milk_choice $1. /* Milk What kind of milk did you usually drink? */ @125 milk_other $char25. /* Milk You selected Other for type of milk. What kind of milk was this? */ @150 soda_did $1. /* Regular Soda Did you drink any regular soda or pop that contains sugar? */ @151 soda_freq $4. /* Regular Soda How often did you drink regular soda or pop? */ @155 soda_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @156 juice_did $1. /* 100% Pure Fruit Juices Did you drink any 100% pure fruit juices such as orange, mango, apple, grape and pineapple juices? */ @157 juice_freq $4. /* 100% Pure Fruit Juices How often did you drink 100% pure fruit juice? */ @161 juice_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @162 coffee_did $1. /* Sweetened Coffee and Tea Did you drink any coffee or tea that had sugar or honey added to it? */ @163 coffee_freq $4. /* Sweetened Coffee and Tea How often did you drink coffee or tea containing sugar or honey? */ @167 coffee_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @168 sweet_drinks_did $1. /* Other Sweetened Drinks Did you drink any sweetened fruit drinks, sports or energy drinks, such as Kool-aid, lemonade, Hi-C, cranberry drink, Gatorade, Red Bull, or Vitamin Water? */ @169 sweet_drinks_freq $4. /* Other Sweetened Drinks How often did you drink sweetened fruit, sports or energy drinks? */ @173 sweet_drinks_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @174 fruit_did $1. /* Fruit Did you eat any fruit? Include fresh, frozen, or canned fruit. Do not include juices. */ @175 fruit_freq $4. /* Fruit How often did you eat fruit? */ @179 fruit_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @180 salad_did $1. /* Green Salad Did you eat a green leafy or lettuce salad, with or without other vegetables? */ @181 salad_freq $4. /* Green Salad How often did you eat salad? */ @185 salad_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @186 potatoes_fried_did $1. /* Fried Potatoes Did you eat any kind of fried potatoes including french fries, home fries, or hash brown potatoes? */ @187 potatoes_fried_freq $4. /* Fried Potatoes How often did you eat any kind of fried potatoes? */ @191 potatoes_fried_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @192 potatoes_oth_did $1. /* Other Potatoes Did you eat any other kind of potatoes, such as baked, boiled, mashed potatoes, sweet potatoes, or potato salad? */ @193 potatoes_oth_freq $4. /* Other Potatoes How often did you eat any other kind of potatoes? */ @197 potatoes_oth_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @198 dry_beans_did $1. /* Cooked Dried Beans Did you eat any refried beans, baked beans, beans in soup, pork and beans or other cooked dried beans? */ @199 dry_beans_freq $4. /* Cooked Dried Beans How often did you eat refried beans, baked beans, beans in soup, pork and beans or other cooked dried beans? */ @203 dry_beans_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @204 grains_did $1. /* Whole Grains Did you eat any brown rice or other cooked whole grains, such as bulgur, cracked wheat, or millet? Do not include white rice. */ @205 grains_freq $4. /* Whole Grains How often did you eat brown rice or other cooked whole grains?*/ @209 grains_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @210 vegetables_did $1. /* Other Vegetables not including green salads, potatoes, and cooked dried beans, did you eat any other vegetables? */ @211 vegetables_freq $4. /* Other Vegetables How often did you eat other vegetables? */ @215 vegetables_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @216 salsa_did $1. /* Salsa Did you eat any Mexican-type salsa made with tomato? */ @217 salsa_freq $4. /* Salsa How often did you have Mexican-type salsa made with tomato? */ @221 salsa_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @222 pizza_did $1. /* Pizza Did you eat any pizza? Include frozen pizza, fast food pizza, and homemade pizza. */ @223 pizza_freq $4. /* Pizza How often did you eat pizza? */ @227 pizza_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @228 sauce_did $1. /* Tomato Sauce Did you have any tomato sauces such as with spaghetti or noodles or mixed into foods such as lasagna? */ @229 sauce_freq $4. /* Tomato Sauce How often did you have tomato sauces? */ @233 sauce_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @234 cheese_did $1. /* Cheese Did you eat any kind of cheese? */ @235 cheese_freq $4. /* Cheese How often did you eat any kind of cheese? */ @239 cheese_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @240 red_meat_did $1. /* Red Meat Did you eat any red meat, such as beef, pork, ham, or sausage? */ @241 red_meat_freq $4. /* Red Meat How often did you eat red meat? */ @245 red_meat_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @246 proc_meat_did $1. /* Processed Meat Did you eat any processed meat, such as bacon, lunch meats, or hot dogs? */ @247 proc_meat_freq $4. /* Processed Meat How often did you eat processed meat? */ @251 proc_meat_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @252 bread_did $1. /* Whole Grain Bread Did you eat any whole grain bread including toast, rolls and in sandwhiches? */ @253 bread_freq $4. /* Whole Grain Bread How often did you eat whole grain bread? */ @257 bread_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @258 candy_did $1. /* Chocolate and Candy Did you eat any chocolate or any other types of candy? Do not include sugar-free candy. */ @259 candy_freq $4. /* Chocolate and Candy How often did you eat chocolate or any other types of candy? */ @263 candy_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @264 doughnuts_did $1. /* Doughnuts Did you eat any doughnuts, sweet rolls, Danish, muffins, (pan dulce) or pop-tarts? Do not include sugar-free items. */ @265 doughnuts_freq $4. /* Doughnuts How often did you eat doughnuts, sweet rolls, Danish, muffins, (pan dulce) or pop-tarts? */ @269 doughnuts_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @270 cookies_did $1. /* Cookies, Cakes, Pie, Brownies Did you eat any cookies, cake, pie, or brownies? Do not include sugar-free kinds. */ @271 cookies_freq $4. /* Cookies, Cakes, Pie, Brownies How often did you eat cookies, cake, pie, or brownies? */ @275 cookies_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @276 desserts_did $1. /* Frozen Desserts Did you eat any ice cream or other frozen desserts? Do not include sugar-free kinds. */ @277 desserts_freq $4. /* Frozen Desserts How often did you eat ice cream or other frozen desserts? */ @281 desserts_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ @282 popcorn_did $1. /* Popcorn Did you eat any popcorn? */ @283 popcorn_freq $4. /* Popcorn How often did you eat popcorn? */ @287 popcorn_units $1. /* Freq Units A=PerDay, B=PerWeek, C=PerMonth, E=Don't Know */ ; run; data dsq; set dsq; *converting responses into times per day for food variables of interest; if juice_did='B' then q9juice=0; else if juice_did='A' then do; if juice_units='A' then q9juice=1*juice_freq; else if juice_units='B' then q9juice=1*juice_freq/7; else if juice_units='C' then q9juice=1*juice_freq/30; end; if fruit_did='B' then q12fruit=0; else if fruit_did='A' then do; if fruit_units='A' then q12fruit=1*fruit_freq; else if fruit_units='B' then q12fruit=1*fruit_freq/7; else if fruit_units='C' then q12fruit=1*fruit_freq/30; end; if salad_did='B' then q13salad=0; else if salad_did='A' then do; if salad_units='A' then q13salad=1*salad_freq; else if salad_units='B' then q13salad=1*salad_freq/7; else if salad_units='C' then q13salad=1*salad_freq/30; end; if potatoes_oth_did='B' then q15othpot=0; else if potatoes_oth_did='A' then do; if potatoes_oth_units='A' then q15othpot=1*potatoes_oth_freq; else if potatoes_oth_units='B' then q15othpot=1*potatoes_oth_freq/7; else if potatoes_oth_units='C' then q15othpot=1*potatoes_oth_freq/30; end; if dry_beans_did='B' then q16beans=0; else if dry_beans_did='A' then do; if dry_beans_units='A' then q16beans=1*dry_beans_freq; else if dry_beans_units='B' then q16beans=1*dry_beans_freq/7; else if dry_beans_units='C' then q16beans=1*dry_beans_freq/30; end; if vegetables_did='B' then q18othveg=0; else if vegetables_did='A' then do; if vegetables_units='A' then q18othveg=1*vegetables_freq; else if vegetables_units='B' then q18othveg=1*vegetables_freq/7; else if vegetables_units='C' then q18othveg=1*vegetables_freq/30; end; if potatoes_fried_did='B' then q14fries=0; else if potatoes_fried_did='A' then do; if potatoes_fried_units='A' then q14fries=1*potatoes_fried_freq; else if potatoes_fried_units='B' then q14fries=1*potatoes_fried_freq/7; else if potatoes_fried_units='C' then q14fries=1*potatoes_fried_freq/30; end; if sauce_did='B' then q21tomsauc=0; else if sauce_did='A' then do; if sauce_units='A' then q21tomsauc=1*sauce_freq; else if sauce_units='B' then q21tomsauc=1*sauce_freq/7; else if sauce_units='C' then q21tomsauc=1*sauce_freq/30; end; if salsa_did='B' then q19salsa=0; else if salsa_did='A' then do; if salsa_units='A' then q19salsa=1*salsa_freq; else if salsa_units='B' then q19salsa=1*salsa_freq/7; else if salsa_units='C' then q19salsa=1*salsa_freq/30; end; if pizza_did='B' then q20pizza=0; else if pizza_did='A' then do; if pizza_units='A' then q20pizza=1*pizza_freq; else if pizza_units='B' then q20pizza=1*pizza_freq/7; else if pizza_units='C' then q20pizza=1*pizza_freq/30; end; *create 3 age/gender variables needed to merge portion size adjustments and regression coefficients; if q2sex='A' then gender=1; else if q2sex='B' then gender=2; IF (2 <= q1age <= 3) THEN AGEGRP=1; ELSE IF (4 <= q1age <= 5) THEN AGEGRP=2; ELSE IF (6 <= q1age <= 7) THEN AGEGRP=3; ELSE IF (8 <= q1age <= 9) THEN AGEGRP=4; ELSE IF (10 <= q1age <= 11) THEN AGEGRP=5; ELSE IF (12 <= q1age <= 13) THEN AGEGRP=6; ELSE IF (14 <= q1age <= 15) THEN AGEGRP=7; ELSE IF (16 <= q1age <= 17) THEN AGEGRP=8; ELSE IF (18 <= q1age <= 27) THEN AGEGRP=9; ELSE IF (28 <= q1age <= 37) THEN AGEGRP=10; ELSE IF (38 <= q1age <= 47) THEN AGEGRP=11; ELSE IF (48 <= q1age <= 57) THEN AGEGRP=12; ELSE IF (58 <= q1age <= 67) THEN AGEGRP=13; ELSE IF (68 <= q1age <= 77) THEN AGEGRP=14; ELSE IF q1age >= 78 THEN AGEGRP=15; *need two categories of age (youth or adult) for regression coefficients; if (2 <= q1age <= 17) then agecut=1; else if q1age >= 18 then agecut=2; run; ***Input tot frt/veg/legume adjustments; data adj; input gender AGEGRP P50q9juice P50q12fruit P50q13salad P50q15othpot P50q16beans P50q18othveg P50q14fries P50q21tomsauc P50q19salsa P50q20pizza; datalines; 1 1 0.734405 0.593960 0.124988 0.341880 0.321000 0.249900 0.320600 0.351000 0.051383 0.253843 1 2 0.751000 0.637200 0.130669 0.499800 0.250038 0.306500 0.318000 0.425250 0.106080 0.256000 1 3 0.812000 0.702503 0.249975 0.500000 0.342000 0.312400 0.372000 0.586703 0.159120 0.284000 1 4 0.812000 0.824490 0.145440 0.750000 0.332000 0.347700 0.545000 0.316000 0.193000 0.283250 1 5 0.843000 0.858231 0.145440 0.515485 0.440250 0.397750 0.375000 0.587000 0.231000 0.290000 1 6 1.249333 0.983798 0.218000 0.765500 0.438150 0.316223 0.479532 0.733000 0.116000 0.401795 1 7 1.312000 0.976005 0.250000 0.700590 0.630700 0.318160 0.545000 0.525000 0.309555 0.496000 1 8 1.439000 0.955500 0.249975 1.000000 0.482000 0.309015 0.711510 0.708500 0.206392 0.546259 1 9 1.480620 0.867300 0.291000 0.836000 0.563000 0.333401 0.622000 0.612000 0.177021 0.647000 1 10 1.458000 0.911790 0.375000 0.767025 0.524700 0.406500 0.663435 0.688000 0.212160 0.729000 1 11 1.437000 0.867300 0.390500 0.874650 0.597726 0.388250 0.548000 0.637962 0.198000 0.694861 1 12 1.147570 0.867300 0.400500 0.930000 0.563000 0.410901 0.548055 0.925000 0.265000 0.693760 1 13 0.999440 0.813000 0.499950 0.809676 0.480533 0.431000 0.545000 0.861500 0.206392 0.759000 1 14 0.812045 0.715500 0.407500 0.809676 0.377000 0.442680 0.455000 0.861800 0.132000 0.542720 1 15 0.780813 0.713000 0.388810 0.536000 0.411000 0.375188 0.444000 0.486000 0.231000 0.293000 2 1 0.734557 0.531500 0.249975 0.499800 0.247050 0.241000 0.272000 0.323700 0.053040 0.198327 2 2 0.754416 0.632000 0.268000 0.500000 0.346000 0.250000 0.293000 0.387810 0.056500 0.256500 2 3 0.749580 0.650160 0.218000 0.500000 0.390320 0.333426 0.455500 0.370000 0.231000 0.290000 2 4 0.798096 0.660667 0.208500 0.562478 0.217736 0.302000 0.272425 0.460802 0.154148 0.248400 2 5 0.815000 0.812333 0.250000 0.715000 0.357500 0.349000 0.456713 0.517080 0.106080 0.300000 2 6 1.000980 0.858980 0.203500 0.515485 0.562118 0.264000 0.493592 0.776000 0.412718 0.319783 2 7 1.103333 0.845610 0.291000 0.749700 0.320000 0.323000 0.455500 0.587000 0.112000 0.350000 2 8 1.300000 0.867000 0.374963 0.501000 0.406725 0.276250 0.543178 0.525000 0.154148 0.444000 2 9 1.242252 0.764240 0.318225 0.749700 0.390000 0.308000 0.480000 0.624000 0.129000 0.433541 2 10 1.003392 0.750000 0.395500 0.500000 0.342000 0.361100 0.446660 0.480000 0.212160 0.444000 2 11 1.000000 0.739187 0.500000 0.697000 0.321000 0.333300 0.444000 0.388000 0.174877 0.432000 2 12 1.000000 0.775915 0.500000 0.555500 0.333000 0.389714 0.385000 0.537240 0.206392 0.431609 2 13 0.813000 0.742000 0.437502 0.570960 0.341398 0.396680 0.455275 0.563000 0.138705 0.488653 2 14 0.749580 0.633000 0.375000 0.666000 0.323400 0.389083 0.444000 0.710000 0.231000 0.569016 2 15 0.750000 0.632000 0.333500 0.515000 0.305000 0.350667 0.320000 0.336660 0.097852 0.390861 ; run; proc sort data=adj; by gender AGEGRP; run; proc sort data=dsq; by gender AGEGRP; run; data dsq; merge dsq (in=d) adj; by gender AGEGRP; if d; run; data dsq; set dsq; *adjust daily intake from dsq using portion size adjustments; aq9juice=q9juice*P50q9juice; aq12fruit=q12fruit*P50q12fruit; aq13salad=q13salad*P50q13salad; aq15othpot=q15othpot*P50q15othpot; aq16beans=q16beans*P50q16beans; aq18othveg=q18othveg*P50q18othveg; aq14fries=q14fries*P50q14fries; aq21tomsauc=q21tomsauc*P50q21tomsauc; aq19salsa=q19salsa*P50q19salsa; aq20pizza=q20pizza*P50q20pizza; *sum together 10 food groups that contribute to frt/veg/legume; * if any food group is missing, overall intake will be missing; fd10FVL=aq9juice+aq12fruit+aq13salad+aq15othpot+aq16beans+aq18othveg+aq14fries+aq21tomsauc+aq19salsa+aq20pizza; *take square root of that value to normalize distribution; sqrtfd10fvl=(fd10FVL)**.5; run; proc sort data=dsq; by agecut gender; run; ***Input tot frt/veg/legume regression coefficients; data coeff; input agecut gender intercept beta1; datalines; 1 1 0.462566 0.811788 1 2 0.392324 0.854301 2 1 0.568998 0.811989 2 2 0.475719 0.835264 ; run; proc sort data=coeff; by agecut gender; run; data dsq; merge dsq (in=d) coeff; by agecut gender; if d; run; data dsq; set dsq; *created predicted fruit/veg/legume intake; PREDtotfv = ( intercept + beta1*sqrtfd10fvl )**2; label PREDtotfv = 'Total frt/veg/legume MPED'; run; proc sort; by gender; run; *show results of predicted value by gender; proc means n nmiss min max mean; by gender; var PREDtotfv; run;