Code:
year age educ inc weight 1992 16 "HS" 1000 20 1992 16 "CG" 1200 23 1993 16 "CG" 1400 24 1994 16 "HS" 1500 19
I have tried the following:
Code:
bysort age educ: egen inc_median_age_educ = median(inc)
1. I cannot include the weights variable in this generation, which makes this wrong. In this FAQ, I am not sure I can include two level variables: https://www.stata.com/support/faqs/d...ry-statistics/. Kindly correct me if I'm wrong.
2. Would there be a way to export this to an external txt/xls file rather than adding an additional column? For now I am using the following:
Code:
#delimit ; tabulate age [aw = weight], summ(inc_median_age_educ) means; /*or*/ /*doesn't work, creates N and mean for age and education separately*/ tabout age educ [aw = weight] using try.xls, replace format(8) ptotal(none) lines (none) sum cells(N wage_median_age_educ mean wage_median_age_educ);
I am using Stata/SE 16.1 on Windows 10.
0 Response to Exporting Mean/Median of Variable X by variables Y and Z
Post a Comment