Page 1 of 1
Updating multiple equations?
Posted: Mon Jun 07, 2010 9:37 am
by cmgconsulting
I have 300+ equations. Is there a quick way to update them all after I've changed the data that they are calculated off of?
Re: Updating multiple equations?
Posted: Mon Jun 07, 2010 9:49 am
by EViews Gareth
You could write a simple program (in EViews 7 only) that would re-estimate every equation in your workfile. Something along the lines of:
Code: Select all
%eqlist=@wlookup("*","equation") 'make a list of all equations in workfile
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
{%eq}.{%estcmd} 're-estimate current equation with its command
next
Re: Updating multiple equations?
Posted: Tue Mar 15, 2011 7:29 pm
by Jun
Hi,
What if I want to loop the following?
genr d1_CONFI = d(CONFI)
genr d1_CPI = d(CPI)
genr d1_FPER = d(FPER)
genr d1_GBY = d(GBY)
genr d2_GDP = d(d(GDP))
genr d1_M1 = d(M1)
genr d2_NFP = d(d(NFP))
genr d1_PMI = d(PMI)
genr d1_TED = d(TED)
genr d1_USD = d(USD)
I tried using:
%serieslist=@wlookup("*","series")
for !i=1 to @wcount(%serieslist)
%currentseries=@word(%serieslist,!i)
genr d1_%currentseries = d(%currentseries)
next
But it doesn't work because the quotes remain for @word.
And then I tried:
%currentseries=@stripquotes(@word(%serieslist,!i))
But that doesnt' work as well...
I think I need some function to convert the word to a variable ro something.
Anyway I just want to loop the process above because my list is really long.
Hope you can help!
Re: Updating multiple equations?
Posted: Tue Mar 15, 2011 7:56 pm
by EViews Gareth
Code: Select all
genr d1_CONFI = d(CONFI)
genr d1_CPI = d(CPI)
genr d1_FPER = d(FPER)
genr d1_GBY = d(GBY)
genr d2_GDP = d(d(GDP))
genr d1_M1 = d(M1)
genr d2_NFP = d(d(NFP))
genr d1_PMI = d(PMI)
genr d1_TED = d(TED)
genr d1_USD = d(USD)
%serieslist=@wlookup("*","series")
for !i=1 to @wcount(%serieslist)
%currentseries=@word(%serieslist,!i)
genr d1_{%currentseries} = d({%currentseries})
next
Re: Updating multiple equations?
Posted: Tue Mar 15, 2011 8:14 pm
by Jun
Thanks Gareth.
I've used your code but I'm having an issue with @abs(ADF(2,!i)) which returns a string.
FYI, ADF is a 4xn matrix and row 1 is the name and rows 2-4 are numbers.
How can I get around this error?
!crival = 4
%serieslist=@wlookup("*","series")
for !i=1 to @wcount(%serieslist)
%currentseries=@word(%serieslist,!i)
if @abs(ADF(2,!i)) < !crival then
genr d1_{%currentseries} = d({%currentseries})
endif
if @abs(ADF(3,!i)) < !crival then
genr d2_{%currentseries} = d(d({%currentseries}))
endif
if @abs(ADF(4,!i)) < !crival then
stop
endif
next
Updating multiple equations?
Posted: Tue Mar 15, 2011 8:51 pm
by EViews Gareth
Adf cannot be a matrix if it contains characters. However to convert a string into a number, you can use the @Val function
Re: Updating multiple equations?
Posted: Thu Sep 06, 2012 9:25 am
by doudou
Hi Gareth,
I have read this post, and I want to update my 20equations after change the data period and data, shall I use the same thing as your 1st reply?
Also any chance eviews can do forecasting with rolling windows?
I am really struggling cos i dnt know any ...
Please see my attached file. if you could help.
Thanks
Re: Updating multiple equations?
Posted: Thu Sep 06, 2012 10:27 am
by EViews Gareth
Re: Updating multiple equations?
Posted: Thu Sep 06, 2012 10:41 am
by doudou
You could write a simple program (in EViews 7 only) that would re-estimate every equation in your workfile. Something along the lines of:
Code: Select all
%eqlist=@wlookup("*","equation") 'make a list of all equations in workfile
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
{%eq}.{%estcmd} 're-estimate current equation with its command
next
hi Gareth,
I just 'Run' this in program but it doesnt work...
I read the Help pdf abt programming still dnt ahve any idea tho..
should I put
%eqlist=@wlookup("*","equation") 'make a list of all equations in workfile -
eq01
eq02
eq03
...
eq20?
or should I have eq01 = usdaud c usoil
eq02 = usdcad c usoil?
then it says equation is not defined.....
should I leave ur comment after the " ' " ? cos I think that wont affect the programe.
Please help me with a correct code?
Many thanks!
Re: Updating multiple equations?
Posted: Thu Sep 06, 2012 10:42 am
by EViews Gareth
Just copy the code exactly as it is.
Re: Updating multiple equations?
Posted: Thu Sep 06, 2012 10:51 am
by doudou
Gareth! It worked! Thanks!
so if I see the code you posted , does that mean I can just copy and paste in a new progame to use it?
I am now trying to do the rolling forecast, I need to include the forecasted result for the nxt forecast, does tht code apply to this as well?
Thanks
Re: Updating multiple equations?
Posted: Thu Sep 06, 2012 11:05 am
by EViews Gareth
You might need to take some time to understand the forecast code.
Re: Updating multiple equations?
Posted: Thu Sep 06, 2012 11:08 am
by doudou
After update all equation, I need to update forecast for each equation.
any code can upadte the forecast by a single click?
thanks!