## Updating multiple equations?

For requesting general information about EViews, sharing your own tips and tricks, and information on EViews training or guides.

Moderators: EViews Gareth, EViews Moderator

cmgconsulting
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?

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

### Re: Updating multiple equations?

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 workfilefor !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 commandnext`

Jun
Posts: 12
Joined: Tue Mar 15, 2011 7:06 pm

### 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!

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12392
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`

Jun
Posts: 12
Joined: Tue Mar 15, 2011 7:06 pm

### 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 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)

genr d1_{%currentseries} = d({%currentseries})
endif

genr d2_{%currentseries} = d(d({%currentseries}))
endif

stop
endif
next

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12392
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

doudou
Posts: 14
Joined: Thu Sep 06, 2012 9:22 am

### 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
Attachments
01 forecast.wf1

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

### Re: Updating multiple equations?

Yes, you can use the initial post.

viewtopic.php?f=15&t=878

doudou
Posts: 14
Joined: Thu Sep 06, 2012 9:22 am

### Re: Updating multiple equations?

EViews Gareth wrote: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 workfilefor !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 commandnext`

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
then it says equation is not defined.....

should I leave ur comment after the " ' " ? cos I think that wont affect the programe.

Many thanks!

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

### Re: Updating multiple equations?

Just copy the code exactly as it is.

doudou
Posts: 14
Joined: Thu Sep 06, 2012 9:22 am

### 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

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

### Re: Updating multiple equations?

You might need to take some time to understand the forecast code.

doudou
Posts: 14
Joined: Thu Sep 06, 2012 9:22 am

### 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!