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;