I have dates in a CSV file saved from excel. The dates are written as the number of days since Jan 1, 1900. How do I convert these for use in Stata? In particular, I'm interested in extracting the month and day? Screen Shot of Day Format Provided in Image
The change of origin is indicated by these examples
. di mdy(1, 1, 1960)
0
. di mdy(1, 1, 1900)
-21914
. di %td mdy(1, 1, 1900) + 21914
01jan1960
from which I gather that your first date is in conventional terms 18 July 2019.
. di %td 43662 - 21914
18jul2019
Your dates appear to be 2 weeks apart, so be sure to declare delta(14)
to tsset
or xtset
.
See help datetime
for standard extraction functions.