Dear statalist,
I have some dates imported from excel, the dates are in string format. I use
to convert them into readable numerically encoded Stata date.
Now I want to preserve only observations within a certain period, specifically, I want to preserve those with publishdate between 23jan2019 to 8apr2019 and between 23jan2020 to 8apr2020. I tried
and stata says "23jan2019 invalid name", I think I need those dates expressed in numbers (I vaguely remember it stands for the number of days since a certain date way back in the 1980s?). How can I know this number, or how can I calculate this?
Thanks a lot for any help!
I have some dates imported from excel, the dates are in string format. I use
Code:
generate publishdate = date(publish_date, "YMD") format %td publishdate
Now I want to preserve only observations within a certain period, specifically, I want to preserve those with publishdate between 23jan2019 to 8apr2019 and between 23jan2020 to 8apr2020. I tried
Code:
keep if 23jan2019 < publishdate < 8apr2019
Thanks a lot for any help!
Comment