--- On Fri, 29/5/09, Martin Weiss wrote:
> Here is code for the necessary dataset, but how do I get
> -text()- to size according to the number of missings?
<snip>
with the -size- option, like in the example below:
*--------------- begin example ---------------------
sysuse auto, clear
tempname hdle
tempfile info
postfile `hdle' str20/*
*/ variable missings using `info'
qui ds, has(type numeric)
qui foreach var in `r(varlist)'{
/*want more missings
to make this interesting */
replace `var'=. if runiform()<0.1
qui cou if `var'==.
post `hdle' ("`var'") (r(N))
}
postclose `hdle'
use `info', clear
gen number=_n
list, noobs
gen x = 1
sum missings, meanonly
gen factor = missings/r(mean)
levelsof variable
tokenize `"`r(levels)'"'
forvalues i = 1/`=_N' {
local f = factor[`i']
local txt `"`txt' text(`i' 1 "``i''", size(*`f'))"'
}
scatter number x, msymbol(i) ///
xtitle("") xscale(off) ///
ytitle("") yscale(off) ///
plotregion(lstyle(none)) ///
`txt'
*----------------- end example -----------------------------
Hope this helps,
Maarten
-----------------------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/