It works great. Thansk a lot for your help!
Xiaoqu
----- Original Message -----
From: "Nick Cox" <[email protected]>
Date: Fri, 1 Nov 2002 09:52:18 -0000
To: <[email protected]>
Subject: st: RE: about stacked mean bar chart
> 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'
> }
>
> 2. Select just one observation from each
> group:
>
> egen tag = tag(v4)
>
> 3. Draw the graph
>
> graph meanv1 meanv2 mean3 if tag, bar stack
>
>
> Nick
> [email protected]
> *
> * For searches and help try:
> * http://www.stata.com/support/faqs/res/findit.html
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
--
Surfy! http://www.surfy.net Great web search, free web email, and $9.95 unlimited Internet access
Powered by Outblaze
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/