# RE: st: histogram

 From "David Harrison" To Subject RE: st: histogram Date Tue, 22 Feb 2005 13:39:56 -0000

```I think you will find that my example did exactly that - the bars in the histogram for price<=12000 add up to about 96% (the other 4% that are >12000 being ignored).

Take the more extreme example of plotting if price>12000 if you need more convincing...

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')

David

-----Original Message-----
From: Hans J. Baumgartner [mailto:hbaumgartner@diw.de]
Sent: 22 February 2005 13:14
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: histogram

Thanks David and Scott for your suggestions but both do not render my
problem.

The thing is that if I draw a histogram of var>190 I do not want the
percent to add up to 100, since 100 percent is var without beeing
restricted to be >190. So var>190 may be only 25 Percnet and so the
histogram should show a scale that adds the bars to 25 Percent.

Any further suggestions?

Hans

Hans J. Baumgartner schrieb:

> Hi,
>
> I am trying to draw a histogram (option: percent). - hist var, percent -
>
> If I attempt to draw the histogram just over a range of the var, i.e. –
> hist var if var<190, percent – the range of <190 is taken as 100% and
> y-axis is scaled accordingly.
>
> How can I draw a histogram over the rage var<190 leaving where the
> entire range of var is taken as the percent base.
>
> Any suggestions?
> Hans
>

--
Hans J. Baumgartner DIW Berlin
German Institute for Economic Research
Dept. Public Economics
Königin-Luise-Str. 5; 14195 Berlin; Germany
Tel.: +49/30/89789-307
Fax.: +49/30/89789-114
http://www.diw.de
http://www.hansbaumgartner.de

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