Getting last observation and (last observation + 1 month) date in eviews

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator

batejwani
Posts: 3
Joined: Thu Apr 26, 2018 3:55 am

Getting last observation and (last observation + 1 month) date in eviews

Postby batejwani » Thu Apr 26, 2018 7:46 am

Hello,
I am working on a group of variables and running autoregression and forecasting monthly values. Since it is a group function, to run autoregression, I need to set last observation date and for forecasting I need to get (last observation date+next month). What formula can I use to resolve this, as the last observation date differs across variables?
For example,
smpl 2000Q1 (code for latest quarter for each variable)
group all_variables variable_1 variable_2 variable_3
for !i = 1 to all_variables.@count
smpl 2000Q1 (code for latest quarter for each variable)
%i= all_variables.@seriesname(!i)
equation eq_{!i}.ls {%i} c ar(1)
'Forecasts
smpl (code for latest quarter for each variable+1 quarter) 2018Q4
eq_{!i}.forecast {%i}_fcst

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11765
Joined: Tue Sep 16, 2008 5:38 pm

Re: Getting last observation and (last observation + 1 month) date in eviews

Postby EViews Gareth » Thu Apr 26, 2018 7:50 am

Code: Select all

%last = {%i}.@last
smpl {%last}+1 @last
Follow us on Twitter @IHSEViews

batejwani
Posts: 3
Joined: Thu Apr 26, 2018 3:55 am

Re: Getting last observation and (last observation + 1 month) date in eviews

Postby batejwani » Thu Apr 26, 2018 8:15 am

Thank you for replying. I am relatively new to Eviews. When I try the codes you suggested, I get the error @last is not defined or is an illegal command. Any way to fix this?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11765
Joined: Tue Sep 16, 2008 5:38 pm

Re: Getting last observation and (last observation + 1 month) date in eviews

Postby EViews Gareth » Thu Apr 26, 2018 8:33 am

I fixed a typo, try again.
Follow us on Twitter @IHSEViews

batejwani
Posts: 3
Joined: Thu Apr 26, 2018 3:55 am

Re: Getting last observation and (last observation + 1 month) date in eviews

Postby batejwani » Thu Apr 26, 2018 8:49 am

This worked! Thank you so much :D


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 7 guests