[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AW: st: Tag clouds in Stata?

From   Maarten buis <>
Subject   Re: AW: st: Tag clouds in Stata?
Date   Fri, 29 May 2009 10:06:17 +0000 (GMT)

--- 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?

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)) ///
*----------------- end example -----------------------------

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen



*   For searches and help try:

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