[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Graphs and number of observations

From   "Nick Cox" <>
To   <>
Subject   st: RE: Graphs and number of observations
Date   Thu, 10 Apr 2008 18:39:23 +0100

In principle you count the number of observations and then put it

. sysuse auto
(1978 Automobile Data)

. count if foreign

. histogram mpg if foreign, subtitle(`r(N)' observations)
(bin=4, start=14, width=6.75)

However, watch out for missings. A more careful count is 

. count if mpg < . & foreign 

as the -histogram- will not show missings. 

See also the -goldbar- code posted yesterday in reply to Richard
Goldstein for some technique. 



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. 

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index