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: SV: How to convert date saved as string in the form of yyyymm
From
Petter Berg <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: SV: How to convert date saved as string in the form of yyyymm
Date
Sun, 29 Dec 2013 22:00:24 +0100
Hi David,
gen date= monthly(your_var,"YM")
format date %tm
should do the trick.
See this excellent Stanford tutorial for further questions on dates
https://www.stanford.edu/group/ssds/cgi-bin/drupal/files/Guides/Working%20with%20Dates%20and%20Times%20in%20Stata.pdf
Best,
Petter
________________________________________
Från: [email protected] [[email protected]] för David Ashcraft [[email protected]]
Skickat: den 29 december 2013 21:48
Till: [email protected]
Ämne: st: How to convert date saved as string in the form of yyyymm
I have monthly panel data for which date is a string variable in the format 2013m1. Now I want to convert this date into stata readable date format. I tried following:
gen date2 = date(date, "ym")
(133566 missing values generated)
or
gen date2 = date(date, "yyyymm")
results are same for both. Can anyone please help me resolve this.
Regards
David Ashcraft
PhD Candidate
Bangor University
*
* 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/
*
* 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/