Jesper Kj�r Hansen <[email protected]>:
I don't think there is one procedure that would work for all graphs.
You might think a -serset- call would give that info, but many graphs
do not encode information on all observations used (e.g. -gr box-
throws out a lot of info). A -tw- graph might use information on 100
observations but use different observations for different plots on the
same graph, so it's not clear what number(s) should be reported in
every instance. E.g. in
sysuse auto, clear
replace pr=. if rep78==1
replace wei=. if rep78==2
scatter pr wei mpg
what number of obs would you like returned? In any case, I think your
general approach will work for most cases you might care about, but I
would remind you to include weights as a qualifier (perhaps accounting
for zero, negative, and missing weights as applicable) too.
On 10/1/07, Jesper Kj�r Hansen <[email protected]> wrote:
> I think I know the answer to this one, but just to be sure:
>
> Is there any formal procedure/option/returned result for identifying the exact number
> of observations a graph is based on, documented or otherwise... besides first
> principles using -count- -sum- and others, that is.
>
> For example:
>
> -count if !mi(<all vars used in graph>) & [if statement | in range]-
>
> The solution works well, but sometimes I can't help thinking that the graph command
> should return the number of observations used - just like an estimation command.
>
> /Jesper
*
* 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/