Looping series

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

hw180286
Posts: 2
Joined: Wed Jul 15, 2009 7:56 am

Looping series

Postby hw180286 » Wed Jul 15, 2009 8:09 am

Hi I'm a bit of a newbie with eviews programming and dont really get it!

I want to carry out a really simple thing.

Basically I have about 100 time series, OLS equations i want to estimate . For simplicity say I have a dependent variable Fruitprice, an explanatory variable vegetableprice and a specific fruit that i want for the additional explanatory variable which varies across each esimation eg.

Fruitprice c vegetableprice orange
Fruitprice c vegetableprice apple
x97 different fruits
Fruitprice c vegetableprice peach

Is there a loop i can use in which i can just copy all the fruit names into a list and loop through each one. I used to use Aremos and you could do something like:

For i = orange, apple, peach,...........;

equation "i".ls fruitprice c vegetableprice "i"

next i

Your help would be greatly appreciated!!!

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

Re: Looping series

Postby EViews Gareth » Wed Jul 15, 2009 8:17 am

You could do it in a similar fashion to Aremos:

Code: Select all

for %i orange apple peach

equation eq_{%i}.ls fruitprice c vegtableprice {%i}

next


However, perhaps an easier approach would be to put all 97 fruits into a group, say called FRUITS, then do:

Code: Select all

for !i =1 to fruits.@count
%name = fruits.@seriesname(!i)
equation eq_{%name}.ls fruitprice c vegtableprice {%name}
next
Follow us on Twitter @IHSEViews

hw180286
Posts: 2
Joined: Wed Jul 15, 2009 7:56 am

Re: Looping series

Postby hw180286 » Wed Jul 15, 2009 8:44 am

That's amazing! thanks so much!!

I dont suppose there is a way of copying all the results to excel somehow?

many thanks again.

Howard

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

Re: Looping series

Postby EViews Gareth » Wed Jul 15, 2009 8:51 am

There's lots of similar questions already posted, and I'm sure with a search you can find a more thorough answer, but the general reply is that the easiest thing to do is add all of your equation outputs to a spool, then print the spool to an rtf file.
Follow us on Twitter @IHSEViews


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 16 guests