Hi, I am trying to make my own module but I have unexpected errors. The following is my module.
Proc iml;
Start op_fun (parm)
Global (start0, f, h ,a ,b, sigma_eta, sigma_e, y, rowz, rowy, coly, fix_f, fix_h, fix_a, fix_b, fix_sigma_eta, fix_sigma_e, pred, vpred, filt, vfilt);
Mu0 = &mu0.;
Sigma0= &sigma0.;
Run
Unpack_parm (f, h ,a ,b, sigma_eta, sigma_e, var, rowz, coly, fix_f, fix_h, fix_a, fix_b, fix_sigma_eta, fix_sigma_e, parm);
Call KALCVF (pred, vpred, filt, vfilt, y, 0, a, f, b, h, var, mu0, sigma0);
Et = y – pred*h`;
Const= 0.5 * coly * rowy * log ( 2* constant ('PI'));
Sum1=0;
Sum2=0;
Do i=1 to rowy;
Vpred_i = vpred [(i-1)*rowz+1: i*rowz,];
Ft=h*vpred_i*T(h) + var [rowz+1:rowz+coly, rowz+1:rowz+coly];
Neg_PED = const + 0.5 * (sum1 + sum2);
if (det(ft)<1E-8) then return (1E10);
et_i =et [i,];
sum1= sum1+log(det(ft));
sum2=sum2+et_i*inv(ft)*T(et_i);
end;
Return (neg_PED);
Finish op_fun;
However, I've got an error message saying that "Module OP_FUN was not defined due to resolution errors."
What is resolution errors? and how should I fix this problem? I am using SAS 9.4.
Invalid characters can cause syntax errors. For example, in the statement
Et = y – pred*h`;
the character that looks like a minus sign appears to be an "n dash", This can occur if you copy/paste the program from a PDF or RTF format.
If you change it to
Et = y - pred*h`;
it should resolve.
Moved to IML forum.
Please paste as code so the format is kept.
I moved it. No need to create a new one.
Please format your code 🙂
The "module not defined" error tends to occur when there is some mis-match of control statements. For example an "end" statement is not preceded by a "do" statement, or "else" is not preceded by "if". I don't actually see any such problem in the code that you have posted, so you may need to give more detail including the log with the full error message.
Invalid characters can cause syntax errors. For example, in the statement
Et = y – pred*h`;
the character that looks like a minus sign appears to be an "n dash", This can occur if you copy/paste the program from a PDF or RTF format.
If you change it to
Et = y - pred*h`;
it should resolve.
Thanks for marking the correct answer. That is all you need to do.
Hi, I am trying to make my own module but I have unexpected errors. The following is my module.
Proc iml;
Start op_fun (parm)
Global (start0, f, h ,a ,b, sigma_eta, sigma_e, y, rowz, rowy, coly, fix_f, fix_h, fix_a, fix_b, fix_sigma_eta, fix_sigma_e, pred, vpred, filt, vfilt);
Mu0 = &mu0.;
Sigma0= &sigma0.;
Run
Unpack_parm (f, h ,a ,b, sigma_eta, sigma_e, var, rowz, coly, fix_f, fix_h, fix_a, fix_b, fix_sigma_eta, fix_sigma_e, parm);
Call KALCVF (pred, vpred, filt, vfilt, y, 0, a, f, b, h, var, mu0, sigma0);
Et = y – pred*h`;
Const= 0.5 * coly * rowy * log ( 2* constant ('PI'));
Sum1=0;
Sum2=0;
Do i=1 to rowy;
Vpred_i = vpred [(i-1)*rowz+1: i*rowz,];
Ft=h*vpred_i*T(h) + var [rowz+1:rowz+coly, rowz+1:rowz+coly];
Neg_PED = const + 0.5 * (sum1 + sum2);
if (det(ft)<1E-8) then return (1E10);
et_i =et [i,];
sum1= sum1+log(det(ft));
sum2=sum2+et_i*inv(ft)*T(et_i);
end;
Return (neg_PED);
Finish op_fun;
However, I've got an error message saying that "Module OP_FUN was not defined due to resolution errors."
What is resolution errors? and how should I fix this problem? I am using SAS 9.4.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.