Programming error messages from Eviews, Help!!!

For questions regarding programming in the EViews programming language.

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

nguyenxuanbac
Posts: 2
Joined: Fri Aug 20, 2010 12:51 am

Programming error messages from Eviews, Help!!!

Postby nguyenxuanbac » Fri Aug 20, 2010 2:10 am

To illustrate the problems I have with Eviews, I create the following example.
Suppose I have a number of models to regress. For simplicity, I take the case of 4 models.

%m1=”y c x1”
%m2=”y c x1 x2”
%m3=”y c x1 x2 x3”
%m4=”y c x1 x2 x3 x4 x5 x6 x7”
To run all of these models in my program by OLS, I simply write

Equation eq1.ls {%m1}
Equation eq2.ls {%m2}
Equation eq3.ls {%m3}
Equation eq4.ls {%m4}

These work quite well in Eviews. However, as a matter of fact, I have many more than 4 models and they all look much more complicated than above-listed. As a result, I want to “generalize” the process by putting them into a for..next loop. Unfortunately, this does not work at all.

Particularly, I tried the following cases in Eviews, but all I receive are error messages:
Case 1 when I want to regress all the models
For !i=1 to 4
Equation eq1.ls {%m!i}
next

Case 2 When I want to regress selected models. Say when I want to regress model 3 only
!criterion=3
For !i=1 to 4
If !i=!criterion then
Equation eq1.ls {%m{!i}}
Endif
Next

Case 3 Since Eviews seems not to accept “}}”, I insert an intermediate variable “%temp”, but it does not work either.
!criterion=3
For !i=1 to 4
If !i=!criterion then
%temp=%m{!}
Equation eq1.ls {%temp}
Endif
next

To deal with these problems, I have the only option to put equations in “If…endif”
Say
If !criterion=1 then
Equation eq1.ls {%m1}
Endif
If !criterion=2 then
Equation eq1.ls {%m2}
Endif

If !criterion=3 then
Equation eq1.ls {%m3}
Endif

If !criterion=4 then
Equation eq1.ls {%m4}
Endif

Imagine if you have tens or even hundreds of models, It is cumbersome to list them in that way. It is the best to use the for..next loop. However, I fail to do that in Eviews. Does anyone have any good ideas to solve these problems. Thank you very much in advance.
Sincerely,
Bac
Nguyenxuanbac@yahoo.com

Moreover, among many minor programming problems, my following two programs do not work at all .
Program 1
%m=”equation besteq.ls y c x1”
{%m}

Program 2
%m=”equation besteq.ls y c x1”
{{%m}}
Eviews seem does not accept this manner. I wonder if Eviews 7.0 has improved these functionalities or not.

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Programming error messages from Eviews, Help!!!

Postby trubador » Fri Aug 20, 2010 2:36 am

I am sure there are many other ways to do it, but the following should work as well:

Code: Select all

for !i=1 to 4 %mn = "%m"+@str(!i) equation eq!i.ls {{%mn}} next

nguyenxuanbac
Posts: 2
Joined: Fri Aug 20, 2010 12:51 am

Re: Programming error messages from Eviews, Help!!!

Postby nguyenxuanbac » Fri Aug 20, 2010 6:08 am

Thank you, Trubador for your instant advice.

Naturally, we would think we can do it in the way you suggested. However, I myself had tried this way before. It did not work at the time. After receiving your suggestion, I tried it again. it still does not work. I personally think Eviews is not designed to understand "{{..}}" . I had commented on this in my first post. When I ran the program you suggested, the following error message came up: "{%mn is not a valid string or automatic scalar name". By this message, Eviews approach to brackets seems to be "out in", not "in out" as we often see in math.

Any comments?

Thanks alot
Bac

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

Programming error messages from Eviews, Help!!!

Postby EViews Gareth » Fri Aug 20, 2010 7:26 am

All of your comments are valid for EViews 6. However I believe all of those "problems" are gone in EViews 7. Notably EViews 7 can handle {{...}}.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests