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 at the end of May, and its replacement, statalist.org is already up and running.


[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 <pschumm@uchicago.edu>
To   <statalist@hsphsun2.harvard.edu>
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index