Page 1 of 1

subroutines

Posted: Thu Oct 16, 2008 9:28 pm
by dhanssen
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?

Re: subroutines

Posted: Thu Oct 16, 2008 10:57 pm
by EViews Gareth
You can use an include statement to include another program that contains a subroutine, which should get you what you want.

Re: subroutines

Posted: Sun Oct 19, 2008 9:28 pm
by dhanssen
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!

Re: subroutines

Posted: Mon Oct 20, 2008 8:07 am
by EViews Gareth
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.

Re: subroutines

Posted: Mon Oct 20, 2008 11:05 am
by dhanssen
ha - thanks. That wasn't registering for some reason.