BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SASingaKorean
Calcite | Level 5

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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.

 

View solution in original post

13 REPLIES 13
ChrisNZ
Tourmaline | Level 20

Moved to IML forum.

 

Please paste as code so the format is kept.

SASingaKorean
Calcite | Level 5
I moved the question to IML. You can delete my question here. Thank you
ChrisNZ
Tourmaline | Level 20

I moved it. No need to create a new one.

Please format your code 🙂

 

IanWakeling
Barite | Level 11

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.

Rick_SAS
SAS Super FREQ

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.

 

SASingaKorean
Calcite | Level 5
Thank you. Yes. You are right. I rewrote them and the problem solved. Thank you very much!
SASingaKorean
Calcite | Level 5
Thank you for your reply. As Rick_SAS advice, I rewrote them and the problem solved.
Rick_SAS
SAS Super FREQ
If the problem is solved, please mark the correct solution and close this thread. Thanks.
SASingaKorean
Calcite | Level 5
Thank you. I marked your answer as the solution. How do I close the thread?
Rick_SAS
SAS Super FREQ

Thanks for marking the correct answer. That is all you need to do.

SASingaKorean
Calcite | Level 5

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: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Multiple Linear Regression in SAS

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.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 13 replies
  • 2459 views
  • 3 likes
  • 5 in conversation