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

RE: st: histogram


From   "David Harrison" <[email protected]>
To   <[email protected]>
Subject   RE: st: histogram
Date   Tue, 22 Feb 2005 12:55:03 -0000

I would suggest you use the command -twoway__histogram_gen- (this is "undocumented", but does have a help file) to generate new variables and then plot them separately, e.g.

sysuse auto, clear
twoway__histogram_gen price, percent gen(h x)
local w=x[2]-x[1]
gen zero=0 if !missing(h)
label var zero "Percent"
twoway rbar h zero x if x<=12000, barw(`w')

Note that this plots all bars from the original histogram (-hist price, percent-) that are centred on a point<=12000 - if you wanted a neat cut at exactly 12000 you would need to specify the -start()- and -width()- options.

David


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