Dear all,
I'm trying to get a bar chart with an overview of the gender proportions within different age groups giving care.
Doing:
(Note: r_caregiver is a sample definition, female_r the sex variable, and age_cat2 the categorical age variable.)
The results are:
This I want to display in a bar graph. The command so far is:
It results in:

However, the given height of the bars and the numbers in the labels are not the percentages, but the means, I guess. Whiy is that? I've read that with the over option, Stata automatically uses percentages. Apart from that, I specified (percent) in the command - so what did I do wrong?
Thanks for any hint or idea!
I'm trying to get a bar chart with an overview of the gender proportions within different age groups giving care.
Doing:
Code:
tab age_cat2 if r_caregiver==1 tab age_cat2 if r_caregiver==1 & female_r==0 tab age_cat2 if r_caregiver==1 & female_r==1
The results are:
Code:
. tab age_cat2 if r_caregiver==1 Age of | respondent | (caregiver) | (cat) | Freq. Percent Cum. -------------+----------------------------------- 40-49 | 18 1.46 1.46 50-59 | 423 34.39 35.85 60-69 | 502 40.81 76.67 70-79 | 244 19.84 96.50 80 und älter | 43 3.50 100.00 -------------+----------------------------------- Total | 1,230 100.00 . tab age_cat2 if r_caregiver==1 & female_r==0 Age of | respondent | (caregiver) | (cat) | Freq. Percent Cum. -------------+----------------------------------- 40-49 | 4 0.67 0.67 50-59 | 169 28.36 29.03 60-69 | 236 39.60 68.62 70-79 | 158 26.51 95.13 80 und älter | 29 4.87 100.00 -------------+----------------------------------- Total | 596 100.00 . tab age_cat2 if r_caregiver==1 & female_r==1 Age of | respondent | (caregiver) | (cat) | Freq. Percent Cum. -------------+----------------------------------- 40-49 | 14 2.21 2.21 50-59 | 254 40.06 42.27 60-69 | 266 41.96 84.23 70-79 | 86 13.56 97.79 80 und älter | 14 2.21 100.00 -------------+----------------------------------- Total | 634 100.00
Code:
graph bar (percent) if r_caregiver==1, over(female_r) over(age_cat2) asyvars /// bar(1, color(dknavy)) bar(2, color(sand)) /// ytitle("") ylabel(0(5)25, angle(horizontal) labsize(medsmall)) /// blabel(total) /// legend(rows(1) ring(6) position(6) label(1 "Männer") label(2 "Frauen"))
However, the given height of the bars and the numbers in the labels are not the percentages, but the means, I guess. Whiy is that? I've read that with the over option, Stata automatically uses percentages. Apart from that, I specified (percent) in the command - so what did I do wrong?
Thanks for any hint or idea!
Comment