subroutines

For questions regarding programming in the EViews programming language.

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

dhanssen
Posts: 35
Joined: Sun Oct 12, 2008 11:03 am

subroutines

Postby dhanssen » Thu Oct 16, 2008 9:28 pm

Hi,

I have a question on the use of subroutines. Specifically, I am trying to find if it is possible to create a subroutine and but call it in from other programs when it is not open or part of those programs. The subroutine would run regressions using an equation imported from those programs. Is this possible?

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

Re: subroutines

Postby EViews Gareth » Thu Oct 16, 2008 10:57 pm

You can use an include statement to include another program that contains a subroutine, which should get you what you want.

dhanssen
Posts: 35
Joined: Sun Oct 12, 2008 11:03 am

Re: subroutines

Postby dhanssen » Sun Oct 19, 2008 9:28 pm

Thanks! I've used this technique, and am still running into some problems. I want my subroutine to import a specified equation from a workfile. The subroutine shell looks like this

subroutine tolerance(series find_tol)

Code: Select all

endsub I have saved this subroutine into a program called tolerance.prg. To call this subroutine from another program, I have include tolerance call tolerance(mcons) where tolerance is the name of the program and the name of the subroutine, and mcons is the name of the equation I want to analyze in the open workfile. When I try to run this program, I get the message, "Type mismatch in arguement 1 in "CALL TOLERANCE(MCONS)"" I'm not sure what I am doing wrong, since I am copying the syntax I see in Eviews help. I don't specify a workfile, because I just want it to refer the the workfile most recently opened/worked with. Could you please advise on what I am doing wrong? Thanks!

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

Re: subroutines

Postby EViews Gareth » Mon Oct 20, 2008 8:07 am

The problem is exactly as the error message indicates - you've created a subroutine that accepts a series, yet you're passing in an equation.

dhanssen
Posts: 35
Joined: Sun Oct 12, 2008 11:03 am

Re: subroutines

Postby dhanssen » Mon Oct 20, 2008 11:05 am

ha - thanks. That wasn't registering for some reason.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests