Page 1 of 1

changing last year of sample

Posted: Wed Jun 03, 2015 6:42 am
by seahorse
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

Re: changing last year of sample

Posted: Wed Jun 03, 2015 8:21 am
by EViews Gareth
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}

Re: changing last year of sample

Posted: Wed Jun 03, 2015 1:02 pm
by seahorse
Thanks so much - that worked perfectly. I am cross with myself I was so very nearly there!!

Cheers