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?

Postby cmgconsulting » Mon Jun 07, 2010 9:37 am

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: 13317
Joined: Tue Sep 16, 2008 5:38 pm

Re: Updating multiple equations?

Postby EViews Gareth » Mon Jun 07, 2010 9:49 am

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
Follow us on Twitter @IHSEViews

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

Re: Updating multiple equations?

Postby Jun » Tue Mar 15, 2011 7:29 pm

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: 13317
Joined: Tue Sep 16, 2008 5:38 pm

Re: Updating multiple equations?

Postby EViews Gareth » Tue Mar 15, 2011 7:56 pm

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

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

Re: Updating multiple equations?

Postby Jun » Tue Mar 15, 2011 8:14 pm

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

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

Updating multiple equations?

Postby EViews Gareth » Tue Mar 15, 2011 8:51 pm

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

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

Re: Updating multiple equations?

Postby doudou » Thu Sep 06, 2012 9:25 am

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
(323.71 KiB) Downloaded 360 times

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

Re: Updating multiple equations?

Postby EViews Gareth » Thu Sep 06, 2012 10:27 am

Yes, you can use the initial post.

viewtopic.php?f=15&t=878
Follow us on Twitter @IHSEViews

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

Re: Updating multiple equations?

Postby doudou » Thu Sep 06, 2012 10:41 am

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

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

Re: Updating multiple equations?

Postby EViews Gareth » Thu Sep 06, 2012 10:42 am

Just copy the code exactly as it is.
Follow us on Twitter @IHSEViews

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

Re: Updating multiple equations?

Postby doudou » Thu Sep 06, 2012 10:51 am

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: 13317
Joined: Tue Sep 16, 2008 5:38 pm

Re: Updating multiple equations?

Postby EViews Gareth » Thu Sep 06, 2012 11:05 am

You might need to take some time to understand the forecast code.
Follow us on Twitter @IHSEViews

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

Re: Updating multiple equations?

Postby doudou » Thu Sep 06, 2012 11:08 am

After update all equation, I need to update forecast for each equation.
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 16 guests