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

st: RE: Adding sample sizes to graph


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Adding sample sizes to graph
Date   Mon, 12 Jan 2004 15:41:50 -0000

One trick: 

I assume -hivst- is numeric with value labels. 

egen n = sum(bmi < . & age < .), by(hivst) 
decode hivst, gen(Hivst) 
replace Hivst = Hivst + " (n = " + string(n) + ")" 
scatter bmi age, by(Hivst) 

Nick 
[email protected] 

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of 
> Wagner, Joseph
> Sent: 12 January 2004 15:20
> To: [email protected]
> Subject: st: Adding sample sizes to graph
> 
> 
> 
> I think this is a fairly simple question but I didn't see 
> anything similar
> in the archive.  I have a large number of scatter plots 
> that I need to
> generate but I have been asked to include the sample sizes 
> in the graphs.
> For example, I want to do a scatter of bmi by age for HIV- 
> and HIV+ so I
> would like to get the sample size reported in each graph 
> but I don't want to
> have to type the sample size for each graph I will need.
> 
> scatter bmi age, by(hivst)
> *
> *   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/
*
*   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