Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Adding sample sizes to graph


From   "Wagner, Joseph" <[email protected]>
To   "STATAList ([email protected])" <[email protected]>
Subject   st: Re: Adding sample sizes to graph
Date   Wed, 14 Jan 2004 15:02:48 -0500

I should have added that Nick's method does work for labels with box over2

I had to create a variable that combined the two variables that I use -over-
with.
-hivst- and -sex- gives me -hivstsex-

But I would like to know if anyone knows of way to get the count value
inside the box.

egen n = sum(bmi < . & sex < .), by(hivstsex)
decode hivstsex, gen(Hivstsex)
replace Hivstsex = Hivstsex + " (n = " + string(n) + ")"
graph box bmi, medtype(line) over(sex, label(labsize(small))) over(Hivstsex)


> The method Nick Cox described did give me my sample sizes but I now have
> been asked to do the same for box plots that are over twice.
> 
> graph box bmi, medtype(line) over(sex, label(labsize(small))) over(hivst)
> box(1, bfcolor(none)) ///
> box(2, bfcolor(none)) blabel(total, position(inside) format(%9.1f))
> 
> -hivst- and -sex- are numeric with value labels
> 
> I was wondering about the blabel option.  Is it possible to get blabel to
> produce the count for that particular box?
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index