Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | John Marvel <jdmarvel@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: graph bar, over() with overall mean |
Date | Thu, 30 Jan 2014 11:44:57 -0500 |
Hi everyone, Please consider the following the graph, which uses the auto data. *********** sysuse auto, clear graph bar (mean) mpg, over(rep78) over(foreign) asyvars nofill legend(off) /// title("MPG, by Domestic/Foreign and Repair Record") ytitle("Mean MPG") ************* As you'll see, the code produces a bar graph with the mean mpg for each category of the rep78 variable, by each category of the foreign variable. My question is: Can I add a bar that represents the overall mean for each category of the foreign variable? In other words, in addition to the five bars shown for the Domestic category, I'd like a sixth bar that shows the overall mean of the Domestic category. The same goes for the Foreign category--I'd like a bar that represents the overall mean of the Foreign category. Thanks very much for your help. (I'm running Stata 13.1 SE). John Marvel * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/