Dear Herve,
here is an example which might help you:
sysuse auto
gen price1=price if rep78==1
gen price2=price if rep78==2
gen price345=price if inlist(rep78,3,4,5)
graph bar price1 price2 price345, over(rep78) bar(1,color(blue))
bar(2,color(red)) nofill
Note 3 things:
1) price is separated into three vars, so that styles can be
controlled individually
2) using graph bar instead of histogram, since option -bar- does not
apply to histogram for some reason.
3) using -nofill-option to align the bars properly
I think you can first compute the frequencies, put them in a small
dataset, then plot it similarly to this example.
Hope this helps.
Best regards, Sergiy
On 4/23/08, Herve STOLOWY <[email protected]> wrote:
> Dear Statalisters:
>
> I get histograms which represent the distributions of earnings (for levels of earnings between -10% and +10% of assets). I get 20 intervals. Each has a width of 1%.
>
> I would like to know if there is a possibility to print in black (or a different color or design) the two intervals directly adjacent to zero (which represent the heart of my study).
>
> I provide below the command lines. (Thanks again to all the replies I received recently and which helped me to be able to get these graphs).
>
> foreach val in "AUS" "FRA" "GBR" {
>
> label define post_ifrs2 0 "Pre IFRS" 1 "Post IFRS"
> label values post_ifrs post_ifrs2
> distinct name if abs(ib_scaled_w)<.1 & country=="`val'" & sample_sum==1 & post_ifrs==0
> local n0 = r(N)
> local n0bis = r(ndistinct)
> distinct name if abs(ib_scaled_w)<.1 & country=="`val'" & sample_sum==1 & post_ifrs==1
> local n1 = r(N)
> local n1bis = r(ndistinct)
> la def `:val label post_ifrs' 0 `"`:label (post_ifrs) 0': `n0' obs."', modify
> la def `:val label post_ifrs' 1 `"`:label (post_ifrs) 1': `n1' obs."', modify
>
> histogram ib_scaled_w if abs(ib_scaled_w)<.1 & country=="`val'" & sample_sum==1, bin(20) by(post_ifrs, note("Number of firms - Pre IFRS: `n0bis' firms, Number of firms - Post IFRS: `n1bis' firms")) title("`val'") saving (hist_`val', replace)
>
> label drop post_ifrs2
>
> }
>
> graph combine hist_AUS.gph hist_FRA.gph hist_GBR.gph, saving(hist_combine.gph, replace) altshrink
>
> Best regards
>
> Herve Stolowy
>
>
>
>
>
>
>
>
> ***********************************************************
> Professeur/Professor
> President of the French Accounting Association (AFC)
> HEC Paris
> Departement Comptabilite Controle de gestion / Dept of Accounting and Management Control
> 1, rue de la Liberation
> 78351 - Jouy-en-Josas
> France
> Tel: +33 1 39 67 94 42 - Fax: +33 1 39 67 70 86
> mail: stolowy at hec dot fr
> web: http://www.hec.fr/stolowy
>
> *
> * 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/