Statalist


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

RE: st: Graph bar with stack


From   "Shehzad Ali" <[email protected]>
To   <[email protected]>
Subject   RE: st: Graph bar with stack
Date   Sat, 16 Aug 2008 03:59:34 +0100

Thank you, Scott. This is very helpful.

Regards,

Shehzad


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Scott Merryman
Sent: 14 August 2008 12:15
To: [email protected]
Subject: Re: st: Graph bar with stack

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/

Internal Virus Database is out of date.
Checked by AVG - http://www.avg.com 
Version: 8.0.138 / Virus Database: 270.4.6/1540 - Release Date: 08/07/2008
06:33

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