Hello!
As per the title of the question, I have some data imported from excel with dates in string YYYY-MM-DD format (DisclosureDate) and I want to convert them to numeric format (create a new variable disclosedate) so that I can work with the data. I tried
but then something strange occurred
It seems disclosedate is float rather than numeric, so I wonder how to convert the variable into a format that stata can work with. Thanks a lot for any help!
As per the title of the question, I have some data imported from excel with dates in string YYYY-MM-DD format (DisclosureDate) and I want to convert them to numeric format (create a new variable disclosedate) so that I can work with the data. I tried
Code:
gen disclosedate = daily(DisclosureDate, "YMD")
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str10 DisclosureDate float disclosedate "2010-03-12" 18333 "2011-02-25" 18683 "2012-03-09" 19061 "2013-03-08" 19425 "2014-03-07" 19789 "2015-03-13" 20160 "2016-03-10" 20523 "2017-03-17" 20895 "2018-03-15" 21258 "2019-03-07" 21615 "2020-02-14" 21959 "2010-03-02" 18323 "2011-03-08" 18694 "2018-03-27" 21270 "2019-03-26" 21634 "2020-03-18" 21992 "2010-04-17" 18369 "2011-04-23" 18740 "2012-04-21" 19104 "2013-04-20" 19468 "2014-04-22" 19835 "2015-04-30" 20208 "2016-04-30" 20574 "2017-04-11" 20920 end
Comment