### Monday, March 20, 2006

## st: RE: How can I change the way Stata clusters the yvars in a bar graph?

You do not specify exactly what you typed or even what command you are using. That almost always helps and never hinders.

I don't know an automated way to do what you want, but it is not too difficult to knit your own. Here is a dopey example:

u auto, clear set scheme s1color graph bar turn, over(foreign) saving(turn_foreign, replace) asyvars /* */ yla(, ang(h)) legend(off) b2title(turn) ytitle(mean values) graph bar trunk, over(foreign) saving(trunk_foreign, replace) asyvars /* */ yla(, ang(h)) ysc(off) legend(off) b2title(trunk) graph combine "turn_foreign" "trunk_foreign", imargin(zero) ycommon row(1) ysize(4) xsize(6)

The first graph should specify a -ytitle()- The second and subsequent graphs should suppress the -yscale()-

All graphs should suppress the -legend()- specify the -b2title()- specify -saving()-

The -graph combine- should join the graphs compactly insist on a common y axis

Nick n.j.cox@durham.ac.uk

Deborah L. Duffy, Ph.D. > I am trying to make a bar graph that contains several y > variables grouped over 1 > categorical variable that has 2 levels (0, 1). Stata > automatically groups all > the yvars together for each level of the categorical variable, e.g., > > Cat1: yvar1 yvar2 yvar3 yvar4 Cat2: yvar1 yvar2 yvar3 yvar4 > > I would like to rearrange the bars into 4 clusters - 1 > cluster for each yvar > containing both levels of the cat var. e.g., > > yvar1:cat1cat2 yvar2:cat1cat2 yvar3:cat1cat2 yvar4:cat1cat2 > > I can do this easily in SPSS ("clustered bar graph") but > haven't been able to > find a way to do it with Stata. I think what I need to do is > something like > the 'ascategory' option only instead of treating the yvars as > the first over > group I need them to be the second over group. Is this possible??

* * 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/

Tag: statalist