Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: indicator for "if cell contains the word or phrase"


From   Shehzad Ali <drshehzad_ali@yahoo.com>
To   Stata List <statalist@hsphsun2.harvard.edu>
Subject   st: indicator for "if cell contains the word or phrase"
Date   Sun, 16 Sep 2012 15:44:52 +0100 (BST)

Dear listers,

I have a variable var1 that describes various situations in the form of long description. I want to generate a dummy variable var2 equal to 1 if var1 contains a certain word 'xyz' or phrase. var1 may contain other words but I want to check if xyz or a certain phrase appears in the cell or not. 

Could anyone suggest the best way to do this?

Many thanks
Shehzad

*
*   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   |   Site index