@dateadd question
Posted: Tue Jun 01, 2010 2:08 am
EV7
Hi,
I have a set of financial series on d5 frequency and I want to obtain the data for each serties 1 week ago, 1 month ago, 1 quarter ago and 1 year ago with reference date the last available data point. For obtaining the value 1 month ago I have used the function
The last available data for some series today is as of May 31 and @dateadd seems to be looking for the data for April 31, which obviously does not exist. Do you have any easy solution that makes @dateadd default to the last day of the month in this case?
Thanks,
Javier
Hi,
I have a set of financial series on d5 frequency and I want to obtain the data for each serties 1 week ago, 1 month ago, 1 quarter ago and 1 year ago with reference date the last available data point. For obtaining the value 1 month ago I have used the function
Code: Select all
%last_dt=@otod(@ilast({%ser}))
!last_dt_n=@dateval(%last_dt,"mm/dd/yyyy")
...
!first_dt_n=@dateadd(!last_dt_n,-1*!n,"mm") 'where !n is 1, 3 and 12
The last available data for some series today is as of May 31 and @dateadd seems to be looking for the data for April 31, which obviously does not exist. Do you have any easy solution that makes @dateadd default to the last day of the month in this case?
Thanks,
Javier