Hi,
I have the variable summarised below which capture 9 (aggregated) groups of foods. I would like to calculate a mean value of a set of other variables in my data such as unit_price (unitp), expenditure(exp), quantity etc. The ultimate goal is to regress (using sureg) mean exp on mean unip and other explanatory so that I get 9 coefficient estimates, one for each group.
Would the bysort command below be useful in this case?,
And if yes, how I can write the sureg command so I can get an estimate for each food group? Grateful if you can tell me macro option(s) to write the command line efficiently.
I have the variable summarised below which capture 9 (aggregated) groups of foods. I would like to calculate a mean value of a set of other variables in my data such as unit_price (unitp), expenditure(exp), quantity etc. The ultimate goal is to regress (using sureg) mean exp on mean unip and other explanatory so that I get 9 coefficient estimates, one for each group.
Would the bysort command below be useful in this case?,
Code:
bysort itemid:egen avexp=mean (exp)
Code:
itemid Freq. Percent Cum. grains 74,936 15.81 15.81 fruit_vegs 124,895 26.35 42.16 pulses 27,755 5.86 48.01 meat 39,080 8.24 56.26 fish 11,816 2.49 58.75 milk_dairy 23,752 5.01 63.76 drinks_bever 31,444 6.63 70.39 oils_fats 23,547 4.97 75.36 others 116,800 24.64 100.00 Total 474,025 100.00
Comment