Coding in sample ranges
Posted: Mon Feb 23, 2015 1:17 pm
I'm trying to produce rolling month ahead forecasts to test a model. The way I'm doing this is by looping over years and months and then setting the sample appropriately. The only way I've found to set my sample range seems really backwards and I'm hoping for a better way. My data is daily with a 5 day week and I'm using Eviews 7.
I'm not sure why I can't just use
But if I do that I get an illegal date. The same happens if I don't assign %first or %last to the @datestr and put it in directly. I'm guessing this is caused by some misunderstanding on my part of how Eviews interprets samples, but I can't figure it out from reading the documentation. If someone could provide a simpler way of coding this, and the intuition behind it I'd be grateful
As a simpler example, this also doesn't work:
even though this does
Code: Select all
for !y = 2001 to 2015 'forecast over all available years
if !y=2015 then !mm=@datepart(@now,"mm") else !mm = 12 'Only forecast from a starting point in the present
endif
for !m = 1 to !mm 'loop through the months of the year
'For each month we produce a remainder of the month forecast and 3 months out
%from = @datestr(@makedate(!y, !m, 15, "yyyy mm dd"),"mm/dd/yyyy")
%to = @datestr(@makedate(!y, !m+3, "yyyy mm"),"mm/dd/yyyy")
smpl %from %to
Code: Select all
smpl @makedate(!y, !m, 15, "yyyy mm dd") @makedate(!y, !m+3, "yyyy mm")As a simpler example, this also doesn't work:
Code: Select all
smpl 2003 @makedate(2004,"yyyy")Code: Select all
smpl 2003 2004