changing last year of sample

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

seahorse
Posts: 13
Joined: Tue Mar 26, 2013 10:24 am

changing last year of sample

Postby seahorse » Wed Jun 03, 2015 6:42 am

Hi folks,

I use the following code to re-estimate all my equations. I would change the end of the sample date to 2012 but I do not want to change the start date (which varies from eqn to eqn). Is there an easy way to do this? At present some eqn's will have their end date specified, some will be @last. I tried getting the third word out of the string with the sample but I think I may be on the wrong track!

Thanks in advance


Code to estimate all equations

%eqlist=@wlookup("*","equation") 'make a list of all equations in workfile
%s = @pagesmpl


for !i=1 to @wcount(%eqlist) 'cycle through the list one at a time
%eq = @word(%eqlist,!i) 'current equation name
%estcmd = {%eq}.@command 'current equation's estimation command
%s = {%eq}.@smpl
smpl {%s}
{%eq}.{%estcmd} 're-estimate current equation with its command

next

smpl 1950 2025

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

Re: changing last year of sample

Postby EViews Gareth » Wed Jun 03, 2015 8:21 am

You're on the right track.

Assuming that all equations' samples are simple sample statements with a start date and end date (no if conditions, and no intra-day specifications), then you just need to do something like:

Code: Select all

%eqsmpl = eq.@smpl %eqstart = @word(%eqsmpl, 1) %s = %eqstart + " 2012" smpl {%s}

seahorse
Posts: 13
Joined: Tue Mar 26, 2013 10:24 am

Re: changing last year of sample

Postby seahorse » Wed Jun 03, 2015 1:02 pm

Thanks so much - that worked perfectly. I am cross with myself I was so very nearly there!!

Cheers


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests