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]

Re: st: Translate Google Trends date system into Stata date system


From   Phil Schumm <[email protected]>
To   <[email protected]>
Subject   Re: st: Translate Google Trends date system into Stata date system
Date   Wed, 1 May 2013 12:34:15 -0500

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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index