Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: graph bar, over() total?-- how do I get a bar with total over categories?


From   "Scott Merryman" <smerryman@kc.rr.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: graph bar, over() total?-- how do I get a bar with total over categories?
Date   Thu, 20 Apr 2006 08:59:54 -0500

Do you mean something like this?

sysuse educ99gdp, clear
set obs 11
replace country = "Total" in 11
qui sum pub
replace pub = r(sum) in 11
qui sum priv
replace priv = r(sum) in 11
generate total = private + public
graph hbar (asis) public private, /// 
  over(country, sort(total) descending) stack percent /// 
  title("Spending on tertiary education, by public and private", /// 
  span pos(11))  subtitle(" ") /// 
  note("Source: OECD, Education at a Glance 2002",span)


Scott


> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Anna Gueorguieva
> Sent: Thursday, April 20, 2006 8:41 AM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: graph bar, over() total?-- how do I get a bar with total over
> categories?
> 
> Dear all,
> I am trying to construct a bar graph over a
> categorical variable with a bar for total over the
> categories.
> E.g. in the following example, I want an extra
> category called "Total" (over the countries listed)
> 
> sysuse educ99gdp, clear
> generate total = private + public
> #delimit ;
> graph hbar (asis) public private,
>   over(country, sort(total) descending) stack percent
>   title("Spending on tertiary education, by public and
> private",
>   span pos(11))
>   subtitle(" ")
>   note("Source: OECD, Education at a Glance 2002",
> span) ;
> #delimit cr
> 
> Thank you in advance!
> Anna
> PS. Using Stat8/SE
> 



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



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index