Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: cleaning string variables


From   Elizabeth Sanders <elizsand@u.washington.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: cleaning string variables
Date   Mon, 11 Jul 2011 14:42:27 -0700 (PDT)

I have a string variable of the form

ABC
DEF/ABC
DEF
DEF/ABC/ABC

etc.,

and want to create a new variable that is 1 if the value includes at least /ABC/ABC

I expect I will be searching for */ABC/ABC*, so I tried

gen newvar=oldvar
newvar if regexm(newvar, "*/ABC/ABC*")

but got an error "=exp required".

What am I missing?

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index