Statalist


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

Re: st: Graph bar question


From   "Scott Merryman" <[email protected]>
To   [email protected]
Subject   Re: st: Graph bar question
Date   Fri, 9 Jan 2009 14:06:35 -0600

sysuse auto
gen low = price <5000
label define low 0 "Low Priced" 1 "High Priced"
label values low low

graph bar mpg, over(rep) over(fore) over(low) blabel(bar)

levelsof rep, local(rep)
levelsof fore, local(for)
levelsof low, local(low)
local i = 1
foreach r of local rep {
	foreach f of local for {
		foreach l of local low {
			qui count if rep == `r' & fore == `f' & low == `l'
			local a = r(N)
			if r(N) > 0 {
				gr_edit .plotregion1.barlabels[`i'].text = {}
				gr_edit .plotregion1.barlabels[`i'].text.Arrpush `a'
				local ++i
			}
			
		}
	}
}


Scott


On Fri, Jan 9, 2009 at 1:23 PM, Ricardo Ovaldia <[email protected]> wrote:
> I could not find how to do this in the manuals:
>
> I am graphing the mean concentration of a substance over three variables using -graph bar, over()-. I would like to have the number of observations (N) for each bar listed on top of the bar. Can I do that in Stata?
>
> . graph bar  concentration, over(local ) over(type) over(member)
>
> Thank you in advance,
>
> Ricardo Ovaldia, MS
*
*   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