On May 1, 2013, at 12:21 PM, Nick Cox wrote:
> In a sufficiently serious script, there would be testing
Agreed, but in many cases, the idiom
gen foo = regexs(<integer>) if regexm(<strvar>,<regexp>)
implements an effective (and flexible) test via the call to -regexm()-. The above has the advantage of providing a result for those observations where the input is properly formed, and sets you up for listing the cases where there is a problem, e.g.,
li <strvar> if mi(foo)
-- Phil
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/