Loading/Compiling Procedures

Helpful hints, useful features you may not be aware of, and more
alexecon
Posts: 72
Joined: Fri Oct 30, 2015 12:16 pm

Loading/Compiling Procedures

Unread post by alexecon »

MacRATS won't let me use a procedure and churns out the dreaded "## CP18. MYPROC is not the Name of a PROCEDURE. (Did you forget to SOURCE?)". MYPROC is in the procedures folder, has a .src file extension. I have SOURCE'd it manually, too. Any ideas?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Loading/Compiling Procedures

Unread post by TomDoan »

Can you post a copy of that?
alexecon
Posts: 72
Joined: Fri Oct 30, 2015 12:16 pm

Re: Loading/Compiling Procedures

Unread post by alexecon »

I have replaced the (three) linreg commands in BaiPerron.src with linreg(robusterrors,lags=4,lwindow=quadratic,...). Saved it with another name ("baiperronrobust.src").

I'm calling the procedure with the following to get the Bai-Perron test results for a model with just a constant.
OPEN DATA "/[...]/Monthly.xls"
CALENDAR(M) 2001:1
DATA(FORMAT=XLS,ORG=COLUMNS,LEFT=1) 2001:01 2014:12 sers1
SOURCE "c:/Applications/RATS 9.0/Procedures/baiperron.src"
@LSUNIT(LAGS=8,MODEL=CRASH,BREAKS=2,METHOD=GTOS) SERS1
@baiperronrobust(maxbreaks=3,minspan=24,tests,noprint) SERS1
# constant
The code works fine up to and including @lsunit. But it does not like @baiperronrobust...
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Loading/Compiling Procedures

Unread post by TomDoan »

source path\baiperron.src won't get a procedure that's on baiperronrobust.src.
alexecon
Posts: 72
Joined: Fri Oct 30, 2015 12:16 pm

Re: Loading/Compiling Procedures

Unread post by alexecon »

No, of course it won't!

But this does not appear to be the problem, as RATS generates the same error message for even the correctly sourced procedures. Anyway, I will insist until I find the problem.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Loading/Compiling Procedures

Unread post by TomDoan »

  1. The name of the file must be exactnameofprocedure.src (case insensitive)
  2. It needs to be on a directory on the procedure search path
  3. You need to make sure you rename the actual procedure the way you want.
If you rename the file, but keep the instruction line in the file as procedure baiperron, even if you get #1 and #2 right, it will load the baiperronrobust.src file but not find the procedure.
alexecon
Posts: 72
Joined: Fri Oct 30, 2015 12:16 pm

Re: Loading/Compiling Procedures

Unread post by alexecon »

OK, the problem was that I'd forgotten to change the name of the procedure IN BaiPerron.src. So, RATS was correctly informing me that I was calling a procedure that did not exist.

EDIT: just seen your response: it was number 3 in this case!

Thanks.
Post Reply