Code:
clear input str6 FirmNo Yr Fdate Pdate 002410 2010 20100120 20100221 002410 2011 20110121 20110222 002410 2012 20120124 20120222 002319 2010 20100127 20100219 002319 2011 20110124 20110220 002319 2012 20120119 20120222 002590 2010 20100201 20100209 #this observation is important! end
Code:
gen PrelimDate = real(Fdate)
Code:
gen GoodFDate = daily(string(PrelimDate, "%8.0f"), "YMD")
As I look through the dataset I've found that some Fdate - when they are first or last day of the month - were misconverted as 20100200. (originally it was 20100201.)
That is the reason that the number of observations for GoodFDate was a bit smaller than that of PrelimDate.
My question is,
1. why did this happen?
2. How can I fix it?
Please help!
0 Response to Please help me troubleshoot converting string date("20100201") into the format Stata recognizes as date
Post a Comment