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/