Quartz | Level 8

## Error with module

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!!!

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);
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;
End;

return P1;
Finish;

Do JJ=1 to NN;

X = - theta1 * log (1- uniform_p(m1,K));
T1=X[Floor(4*m1/5)];

print J1 K newK ;
End;
Quit;

1 ACCEPTED SOLUTION

Accepted Solutions
SAS Super FREQ

## Re: Error with module

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);

2 REPLIES 2
SAS Super FREQ

## Re: Error with module

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);

SAS Super FREQ

## Re: Error with module

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``````