Dear Austin:
Once again, I appreciate your help. With your reply (and I also thank Nick, Friedrich and Hind), I was able to find the relevant solution to me:
foreach val in "AUS" "FRA" "GBR" {
label define post_ifrs2 0 "Pre IFRS" 1 "Post IFRS"
label values post_ifrs post_ifrs2
count if ib_scaled_w >-.1 & ib_scaled_w<.1 & country=="`val'" & sample_sum==1 & post_ifrs==0
local n0 = r(N)
count if ib_scaled_w >-.1 & ib_scaled_w<.1 & country=="`val'" & sample_sum==1 & post_ifrs==1
local n1 = r(N)
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 ib_scaled_w >-.1 & ib_scaled_w<.1 & country=="`val'" & sample_sum==1, bin(20) by(post_ifrs) title("`val'") saving (hist_`val', replace)
label drop post_ifrs2
}
I also like Friedrich' solution of adding a note.
Best regards
Herve
***********************************************************
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
>>> "Austin Nichols" <[email protected]> 10/04/08 19:32 >>>
Herve STOLOWY <[email protected]>:
I'm not sure what you're looking for--do you mean display the count of
obs on the relevant part of the graph? It would help if you gave an
example using the auto data, like so:
sysuse auto, clear
histogram mpg if mpg>25 & mpg<40, by(for) bin(20) name(wo, replace)
count if mpg>25 & mpg<40 & for==0
local n0=r(N)
count if mpg>25 & mpg<40 & for==1
local n1=r(N)
la def `:val label for' 0 `"`:label (for) 0': `n0' obs."', modify
la def `:val label for' 1 `"`:label (for) 1': `n1' obs."', modify
histogram mpg if mpg>25 & mpg<40, by(for, title(With #Obs.)) bin(20)
On Thu, Apr 10, 2008 at 1:17 PM, Herve STOLOWY <[email protected]> wrote:
> Dear Statalisters:
>
> I am starting to use graphs. So, I hope that you will forgive my probably basic question.
>
> I run the following command:
>
> histogram ib_scaled_w if ib_scaled_w >-.1 & ib_scaled_w<.1 & country=="AUS" & sample_sum==1, bin(20) by(post_ifrs) title("AUS") saving (hist_AUS, replace)
>
> post_ifrs is a binary variable (coded 0 or 1).
>
> Is there a way to display the total number of observations corresponding to each of the histograms obtained with the command? (one graph with post_ifrs = 0 and one graph with post_ifrs=1)
>
> I searched in the Graphics Stata manual but did not find the solution.
>
> Best regards
>
> Herve 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/