gen byte wheretheactionis = strpos(myvar, "action") > 0
or in Stata < 9
gen byte wheretheactionis = index(myvar, "action") > 0
Nick
[email protected]
Erik Brouwer
> I have a question. I have a string variable containing a
> short description
> (3 till 5 words per observation). What I would like to do is
> to make a dummy
> which equals 1 if the string variable contains the word
> "action". The word
> "action" is not allways on the same place. Can someone help me?
*
* 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/