Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
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/