BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Salah
Quartz | Level 8

Hi

 

I am having a nightmare!!!

I am having an error with part of my code. I believe that I know what is the error message means but I can't figure out how to solve it. I checked everything, I printed every value to make sure that it is well defined and yet once SAS reached that statement, it doesn't execute it!!!

Please help me.

Thank you

 

proc iml;
 
seed=22;  theta1=0.1; theta2=0.5;
 
NN=5;
 
case=1; n1=20;  m1=5; k=J(m1,1,0); K[1]=n1-m1; 
 
******************************************************************************;
start Uniform_p(m,R)  global(seed);
 
** The Required Progressively Type-II from U(0,1);
 
V=J(m,1,0); U=J(m,1,0);W=J(m,1);
 
Call randseed(seed);
Call randgen(W, "Uniform");
 
Do i=1 to m;
Sum=0;
Do j=m-i+1 to m;
Sum=Sum+R[j];
End;
Sum=Sum+i;
V[i]=W[i]**(1/Sum);
 
End;
 
Do i=1 to m;
U[i]=1-prod ( V[m: (m-i+1)]   );
End;
 
Call sort (U); 
return U;
Finish;
 
********************************************************************;
 
Start Adaptive(X, T, n, m, R,theta) ;
 
Do idx=1 to m-1;
If (( X[idx] < T) & (T <= X[idx+1] )) then j=idx;           
End;
 
If X[m]>T then 
 
 
Do;
W=Uniform_p(m-j,R);
X_m_j = T - theta*log(1-W);    
X_Adptive= X[1:j]//X_m_j;
RJ=R((m-j),1,0); RJ[(m-j)]=n-m-sum(R[1:J]);
newR=R[1:J]//RJ;
 
End;
 
else 
 
Do;
j= m;
newR=R;
X_Adptive=X;
End;
 
P1=[X_Adptive,j,newR];
 
return P1;
Finish;
 
Do JJ=1 to NN;
X=J(m1,1,0); X_ADP=J(m1,1,0);
 
X = - theta1 * log (1- uniform_p(m1,K));
T1=X[Floor(4*m1/5)];
 
AdaptiveResX=Adaptive(X, T1,n1,m1,K,theta1);
X_ADP=AdaptiveResX$1;* This is my Adaptive IIPH that I will use to find MLEs;
J1=AdaptiveResX$2;
newK=AdaptiveResX$3;
 
print J1 K newK ;
End;
Quit;
 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

The error is 

ERROR: Invocation of unresolved module R.

statement : ASSIGN at line 17681 column 1
traceback : module ADAPTIVE at line 17681 column 1

 

The error occurs because of the invalid statement:

RJ=R((m-j),1,0);

The SAS IML language thinks you want to call a function module named R that has three arguments.

I don't know what you intended, but perhaps something like

RJ=j((m-j),1,0);

 

 

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

The error is 

ERROR: Invocation of unresolved module R.

statement : ASSIGN at line 17681 column 1
traceback : module ADAPTIVE at line 17681 column 1

 

The error occurs because of the invalid statement:

RJ=R((m-j),1,0);

The SAS IML language thinks you want to call a function module named R that has three arguments.

I don't know what you intended, but perhaps something like

RJ=j((m-j),1,0);

 

 

Rick_SAS
SAS Super FREQ

By the way, you can make your posts easier to read and to copy/paste if you use the "Running Man" icon to paste your SAS programs into the post. For example, you can get your code to look like this:

proc iml;
 seed=22;  theta1=0.1; theta2=0.5;
 ...
QUIT

This will make it easier for others to read your questions.

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
  • 2 replies
  • 823 views
  • 1 like
  • 2 in conversation