--- On Mon, 13/7/09, Antonio Acconcia wrote:
> I have a number of variables, say x1-x10, with different
> number of observations all containing strings. I need to
> select those strings that (or simply to count how many
> strings) are present in x1-x2, x1-x3, and so on; how many
> are present in x2-x3, x2-x4, and so on ....but not in x1
> ..... The same string can appear at different lines (say
> observation 1 for x1 and observation 3 for x2).
levelsof x1
local levs "`r(levels)'"
levelsof x2
local levs "`levs' `r(levels)'"
local levs : list uniq levs
local k : word count `levs'
di "number of strings in x1 and x2 = " `k'
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/