Hi,
I am trying to save a date range as a macro. I have it working to a degree with:
The variable is then called Dates_22084_22095. This is the date range I want, but I want it in any readable format. Not the numeric float.
I have ready all the other posts I found on the topic, this one being preeminent https://www.statalist.org/forums/for...dnnccyy-format.
I can create a macro with today's date using the below code but cannot do the same for a date of interest in the past.
This gives 2072020. Today being the 2nd of July 2020
Can anyone tell me how to make a macro with a past date in understandable format?
Thanks.
I am trying to save a date range as a macro. I have it working to a degree with:
Code:
su date local min = `r(min)' local max = `r(max)' global ran= "`min'_`max'" gen Dates_$ran=.
I have ready all the other posts I found on the topic, this one being preeminent https://www.statalist.org/forums/for...dnnccyy-format.
I can create a macro with today's date using the below code but cannot do the same for a date of interest in the past.
Code:
local wanted : di %tdDNCY daily("$S_DATE", "DMY") di "`wanted'"
Can anyone tell me how to make a macro with a past date in understandable format?
Thanks.
Comment