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: Convert to stata date - stored as a numeric variable
From
David Ashcraft <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: Convert to stata date - stored as a numeric variable
Date
Wed, 11 Sep 2013 22:44:50 -0700 (PDT)
Hello everyone,
My date variable is stored as numeric (double %8.0g). Date format is 20121231 i.e. YYYYMMDD. Stata does not read it as a date. I have tried the following but it seems that I am missing something.
gen date2=date(date,"MDY")
generate date1= mofd(date2)
format date1 %tm
Although my data is quarterly but to be on the safer side I am formatting it as %tm.
Any help will be greatly appreciated.
David Ashcraft
PhD Candidate
Bangor University
Bangor, UK.
*
* 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/