Updating multiple equations?
Moderators: EViews Gareth, EViews Moderator

 Posts: 38
 Joined: Mon Nov 17, 2008 8:25 am
Updating multiple equations?
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?

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12584
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Updating multiple equations?
You could write a simple program (in EViews 7 only) that would reestimate 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} 'reestimate current equation with its command
next
Follow us on Twitter @IHSEViews
Re: Updating multiple equations?
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!
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!

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12584
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Updating multiple equations?
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
Follow us on Twitter @IHSEViews
Re: Updating multiple equations?
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 24 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
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 24 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

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12584
 Joined: Tue Sep 16, 2008 5:38 pm
Updating multiple equations?
Adf cannot be a matrix if it contains characters. However to convert a string into a number, you can use the @Val function
Follow us on Twitter @IHSEViews
Re: Updating multiple equations?
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
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
 Attachments

 01 forecast.wf1
 (323.71 KiB) Downloaded 214 times

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12584
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Updating multiple equations?
Follow us on Twitter @IHSEViews
Re: Updating multiple equations?
EViews Gareth wrote:You could write a simple program (in EViews 7 only) that would reestimate 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} 'reestimate 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!

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12584
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Updating multiple equations?
Just copy the code exactly as it is.
Follow us on Twitter @IHSEViews
Re: Updating multiple equations?
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
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

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12584
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Updating multiple equations?
You might need to take some time to understand the forecast code.
Follow us on Twitter @IHSEViews
Re: Updating multiple equations?
After update all equation, I need to update forecast for each equation.
any code can upadte the forecast by a single click?
thanks!
any code can upadte the forecast by a single click?
thanks!
Return to “General Information and Tips and Tricks”
Who is online
Users browsing this forum: No registered users and 3 guests