Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: graph bar, over() with overall mean


From   John Marvel <[email protected]>
To   [email protected]
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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index