Friedrich Huebler
> The revised commands are:
>
> #delimit ;
> sum rg5;
> local scalemax = r(max);
> local textpos1 = r(max)/100*20;
> local textpos2 = r(max)/100*50;
> sum rg5 if sex==1;
> local mvalue = string(r(max), "%2.1f");
> sum rg5 if sex==2;
> local fvalue = string(r(max), "%2.1f");
> graph bar rg5,
> over(sex, sort(order) gap(0) axis(off))
> bar(1, bcolor(0 153 255) blcolor(white))
> yscale(r(0 `scalemax') off) ylabel(minmax, nogrid)
> outergap(0) plotr(m(zero))
> graphregion(color(white) margin(zero))
> text(`textpos1' 25 "Girls", size(20) color(white))
> text(`textpos1' 75 "Boys", size(20) color(white))
> text(`textpos2' 25 "`fvalue'%", size(20) color(white))
> text(`textpos2' 75 "`mvalue'%", size(20) color(white))
> legend(off);
>
A further small refinement is make each -summarize-
-summarize, meanonly-. -meanonly- is not
a good name, as other things are calculated.
The -meanonly- has two tiny but definite
advantages for problems like these:
1. Faster calculation.
2. Suppression of output.
I guess that here #1 is totally trivial, but #2 is
worth noting. These features become more important
for other problems whenever you don't need the variance
or SD.
Nick
[email protected]
*
* 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/