Statalist


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

Re: st: Graph bar with stack


From   "Scott Merryman" <[email protected]>
To   [email protected]
Subject   Re: st: Graph bar with stack
Date   Thu, 14 Aug 2008 06:15:25 -0500

This should work in Stata 9:

sysuse auto,clear
graph bar mpg turn trunk, over(rep)  stack blabel(bar) name(gr1,replace)

graph bar mpg turn trunk, over(rep) percent stack blabel(bar)

local j = 1
forv i  = 1/5 {
        foreach var of varlist mpg turn trunk {
                qui sum `var' if rep == `i'
                local a = round(r(mean),.001)
                gr_edit .plotregion1.barlabels[`j'].text = {}
                gr_edit .plotregion1.barlabels[`j'].text.Arrpush `a'
                local ++j
       }
}

Scott


On Wed, Aug 13, 2008 at 10:42 AM, Shehzad Ali <[email protected]> wrote:
> Thanks, Scott. Can this be done in Stata version 9?
>
> Shehzad
>
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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