Hi,
I encounter a weird problem when using the regexm command. I want to
recoganize "CEO" from a job title variable, B. Note there are many
missing values in B. Here is the command I use:
gen Bh=regexm(B, "CEO")
However, for some missing Bs, it returns zero for Bh. See below:
. list B Bh in 28107/28110
+----------------+
| B Bh |
|----------------|
28107. | 1 |
28108. | 1 |
28109. | President 0 |
28110. | Senior VP 0 |
+----------------+
. count if B=="" & Bh==1
63
. count if B=="" & Bh==0
6186
. replace Bh=regexm(B, "CEO") if B=="" & Bh==1
(63 real changes made)
. count if B=="" & Bh==1
0
What did I do wrong? Could you please help me out? Thank you!
Yun
*
* 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/