Statalist


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

st: count same strings among variables


From   Antonio Acconcia <acconcia@unina.it>
To   statalist@hsphsun2.harvard.edu
Subject   st: count same strings among variables
Date   Thu, 16 Jul 2009 13:06:18 +0200


  Dear Martin,

your modified version of Maarten`s code works very well for my purpose.

Thanks a lot.

Antonio

*************
sysuse auto, clear

clonevar make2=make
replace make="" in 2
replace make="" in 5
replace make="" in 22
replace make="" in 72
replace make2="" in 6
replace make2="" in 23

levels make
local levs "`r(levels)'"
levels make2
local levs2 "`r(levels)'"

/*same strings */
local levs3: list levs & levs2

di "number of strings " /*
 */ "in make and make2 = " /*
 */  `: word count `levs3''
*************


  ---------------------------------------
  Antonio Acconcia
  CSEF - Dipartimento di Economia
  Università di Napoli Federico II
  via Cinthia, 45 (Monte S.Angelo)
  80126 Napoli - Italia
  Tel: +39-81- 675096
  Fax: +39-81-7663540


*
*   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/



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