Xiaoqu Luo
I want to creat stacked bar chart where each bar stands for
the mean of a variable. I tried using "graph v1 v2 v3, bar
means by (v4) stack" to produce this but STATA said that it
was invalid. It looks like "stack" cannot be used with
means (i.e. "stack" option can only have the bar to
represent counts). Do you have any idea to do stacked bar
chart on mean?
I guess that -graph, bar- was written with
the notion that people might want to stack
totals, but not means.
One work-around would be as follows:
1. Create variables which are means
and give them the same variable labels as
the originals:
foreach v of var v1 v2 v3 {
bysort v4 : egen mean`v' = mean(`v')
_crcslbl mean`v' `v'
}
<snip>