<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Subroutine error in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Subroutine-error/m-p/894153#M6061</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using my previous code which is working fine, just changed the density. I keep getting warning messages "&lt;FONT color="#339966"&gt;WARNING: Invalid argument resulted in missing value result."&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I check the line that caused this issue and printed it to see all values, but I found no problem with it.&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Can you please help me figure out it and solve this issue.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Thank you&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc iml;


*seed=0;  NN=10;

theta1=2;   theta2=10;   del=3;

case=2; n1=30; m1=15;   k=J(m1,1,0); K[m1]=n1-m1;       L=K;    	n2=n1;     m2=m1;	

**********************************************************************************************************************;

***********************  		Exact OVL 		*******************************;
						
						
R=(theta1/theta2); 
R_star=((m2-1)/m2)*R; 

R1=R_star;

rho_Exact=2*sqrt(R1)/(1+R1);
lambda_Exact=(2*sqrt(R1)/(1+R1))**2;
delta_Exact=1-R1**(1/(1-R1))*abs(1-1/R1);

******************************************************************************;
start Uniform_p(m,R)  global(seed);

V=J(m,1,0); U=J(m,1,0);W=J(m,1);

W=randfun(m,"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(n,m,R,theta) Global(del) ;

U=uniform_p(m,R);

Y=( log ( 1 -  (1- U)##(1/theta)  ) ) ;

X = - y ##(-1/del);

T=X[m]+2; 

Do idx=1 to m-1;
	If (( X[idx] &amp;lt; T) &amp;amp; (T &amp;lt;= X[idx+1] )) then j=idx;           
End;

If X[m]&amp;gt;T then 

		Do;
			W=Uniform_p(m-j,R);

			WE= (1 - Exp(-1/T##del));

			X_m_j =( -1/ ( log ( 1 -  ( (1- W)##(1/theta) ) # WE ) ) )##del;

			X_Adptive= X[1:j]//X_m_j;
			Rm=n-m-sum(R[1:J]);
			R2=J(m-j,1,0);R2[m-J]=Rm;
			newR=R[1:j]//R2;

		End;
	
Else 

		Do;
			j= m;
			newR=R;
			X_Adptive=X;
		End;

P1=[X_Adptive,j,newR,y];

return P1;
Finish;

********** Subroutine to compute the MLEs  **************;
*********************************************************;
						
start MLE(X,n,m,R,J);

	Part=1-Exp(- 1/X##(-del));

	deno = R[m]*log(part[m])+ sum (log(part)) + sum( (R#log(part))[1:J] ) ;
		
	Theta_MLE = (- m/deno); 
	
return(Theta_MLE);
finish;

******************************************************************************************;

theta1_Adp=J(NN,1,0); theta2_Adp=J(NN,1,0);H_Adp=J(NN,1,0);
R_star_Adp=J(NN,1,0);


rho_star_Adp=J(NN,1,0);Var_rho_Adp=J(NN,1,0);Bias_rho_Adp=J(NN,1,0);
lambda_star_Adp=J(NN,1,0);Var_lambda_Adp=J(NN,1,0);Bias_lambda_Adp=J(NN,1,0);
delta_star_Adp=J(NN,1,0);Var_delta_Adp=J(NN,1,0);Bias_delta_Adp=J(NN,1,0);
MSE_rho_Adp=J(NN,1,0);MSE_lambda_Adp=J(NN,1,0);MSE_delta_Adp=J(NN,1,0);

Lower_rho_Adp=J(NN,1);Upper_rho_Adp=J(NN,1);Length_rho_Adp=J(NN,1);
Lower_lambda_Adp=J(NN,1);Upper_lambda_Adp=J(NN,1);Length_lambda_Adp=J(NN,1);
Lower_delta_Adp=J(NN,1);Upper_delta_Adp=J(NN,1);Length_delta_Adp=J(NN,1);
COV1_Adp=J(NN,1,0);COV2_Adp=J(NN,1,0);COV3_Adp=J(NN,1,0);***COVi= stands for coverage of OVLi, i=1,2,3**;
var_rho_Adp=J(NN,1,0);var_lambda_Adp=J(NN,1,0);var_delta_Adp=J(NN,1,0);

MSE1=J(NN,1,0);MSE2=J(NN,1,0);MSE3=J(NN,1,0);

Do JJ=1 to NN;

		X=J(m1,1,0);Y=J(m2,1,0); X_ADP=J(m1,1,0);Y_ADP=J(m2,1,0);


		*********************************************************************;

		
		AdaptiveResX=Adaptive(n1,m1,K,theta1);
		X_ADP=AdaptiveResX$1;
		J1=AdaptiveResX$2;
		newK=AdaptiveResX$3;
		y=AdaptiveResX$4;print y;
		K=newK;	
		
		AdaptiveResY=Adaptive(n2,m2,L,theta2);
		Y_ADP=AdaptiveResY$1;
		J2=AdaptiveResY$2;
		newL=AdaptiveResY$3;
		L=newL;	

		Theta1_Adp[JJ] = MLE(X_ADP,n1,m1,K,J1);
		Theta2_Adp[JJ] = MLE(Y_ADP,n2,m2,L,J2);

		
		R_star_Adp[JJ]=(m2-1)/m2*(theta1_Adp[JJ]/theta2_Adp[JJ]);
End;


** The estimated values of the OVL **;

rho_star_Adp=2#sqrt(R_star_Adp)#(1+R_star_Adp)##(-1);
lambda_star_Adp=rho_star_Adp##2;
delta_star_Adp=1-R_star_Adp##(1/(1-R_star_Adp))#abs(1-1/R_star_Adp);

****** Asymptotic Variance of the Overlap ********;

var_rho_Adp=R_star_Adp#(1-R_star_Adp)##2/(1+R_star_Adp)##4#(m1+m2-1)/(m1*(m2-2));

var_lambda_Adp=16#R_star_Adp##2#(1-R_star_Adp)##2/(1+R_star_Adp)##6#(m1+m2-1)/(m1*(m2-2));

var_delta_Adp=(m1+m2-1)/(m1*(m2-2))#R_star_Adp##(2/(1-R_star_Adp))#(log(R_star_Adp))##2/(1-R_star_Adp)##2;

******   Asymptotic Bias of the Overlap   ********;


Bias_rho_Adp=(m1+m2-1)/( m1*(m2-2))# sqrt(R_star_Adp)# ( 3#R_star_Adp##2-6#R_star_Adp-1)/( 4#(1+R_star_Adp)##3 );

Bias_lambda_Adp=(m1+m2-1)/(m1*(m2-2))#4#R_star_Adp##2#(R_star_Adp-2)/(1+R_star_Adp)##4; 

H_Adp= R_star_Adp##(1/(1-R_star_Adp))  # ( R_star_Adp#(2#R_star_Adp-log(R_star_Adp)-2)#log(R_star_Adp) - (R_star_Adp-1)##2   )/(R_star_Adp-1)##3;

H_Adp=R_star_Adp##2 #  R_star_Adp##((2#R_star_Adp-1)/(1-R_star_Adp)) # (  R_star_adp #
		(2#R_star_Adp-log(R_star_Adp)-2)#log(R_star_Adp) - (R_star_Adp-1)##2   )/(R_star_Adp-1)##3;


Do JJ=1 to NN;
	if (R_star_Adp[JJ] &amp;gt; 1) then Bias_delta_Adp[JJ]=(m1+m2-1)/(2*m1*(m2-2))* H_Adp[JJ]/2;
	if (R_star_Adp[JJ] &amp;lt; 1) then Bias_delta_Adp[JJ]=-(m1+m2-1)/(2*m1*(m2-2))* H_Adp[JJ]/2;

End;

Theta1_h=theta1_Adp[:];
Theta2_h=theta2_Adp[:];

Bias_rho=Bias_rho_Adp[:]; Bias_lambda=Bias_lambda_Adp[:]; Bias_delta=Bias_delta_Adp[:]; 


** I used MSE below b/c it provides smaller MSE values;

MSE1 = ( rho_star_Adp    - rho_Exact )##2;
MSE2 = ( lambda_star_Adp - lambda_exact)##2;
MSE3 = ( delta_star_Adp  - delta_exact)##2;


Var1= Var_rho_Adp[:];
Var2= Var_lambda_Adp[:];
Var3= Var_delta_Adp[:];


**** Interval estimation using Asymptotic technique ****;

Do JJ=1 to NN;

***************************		 		OVL1			*****************************;

Lower_rho_Adp[JJ] = rho_star_Adp[JJ] -  Bias_rho_Adp[JJ] - 1.96*sqrt(Var_rho_Adp[JJ]);
Upper_rho_Adp[JJ] = rho_star_Adp[JJ] -  Bias_rho_Adp[JJ] + 1.96*sqrt(Var_rho_Adp[JJ]);

Length_rho_Adp[JJ]=Upper_rho_Adp[JJ]-Lower_rho_Adp[JJ]; 

If ( (rho_exact &amp;gt;= Lower_rho_Adp[JJ])&amp;amp; (rho_exact &amp;lt;= upper_rho_Adp[JJ]) ) then COV1_Adp[JJ]=1;* COV is the coverage;
*************************************************************************************;

***************************		 		OVL2			*****************************;


Lower_lambda_Adp[JJ] = lambda_star_Adp[JJ]     - Bias_lambda_Adp[JJ] - 1.96*sqrt(Var_lambda_Adp[JJ]);
Upper_lambda_Adp[JJ] = lambda_star_Adp[JJ]     - Bias_lambda_Adp[JJ] + 1.96*sqrt(Var_lambda_Adp[JJ]);

Length_lambda_Adp[JJ]= Upper_lambda_Adp[JJ] - Lower_lambda_Adp[JJ]; 

If ( (lambda_exact  &amp;gt;= Lower_lambda_Adp[JJ])&amp;amp; (lambda_exact &amp;lt;= upper_lambda_Adp[JJ]) ) 
										then COV2_Adp[JJ]=1; 

**************************************************************************************;

***************************		 		OVL3			******************************;


Lower_delta_Adp[JJ] = delta_star_Adp[JJ]   - Bias_delta_Adp[JJ] - 1.96*sqrt(Var_delta_Adp[JJ]);
Upper_delta_Adp[JJ] = delta_star_Adp[JJ]   - Bias_delta_Adp[JJ] + 1.96*sqrt(Var_delta_Adp[JJ]);

Length_delta_Adp[JJ]= Upper_delta_Adp[JJ]  -Lower_delta_Adp[JJ];

If ( (delta_exact &amp;gt;= Lower_delta_Adp[JJ])&amp;amp; (delta_exact &amp;lt;= upper_delta_Adp[JJ]) ) 
					                    then COV3_Adp[JJ]=1; 


end;

***************** 						END Of Simulations	 					************************;
********************************************************************************************************;

BiasOVL1_Adp=ABS(Bias_rho_Adp[:]); ** why I added 0.001 is explained above ;
BiasOVL2_Adp=ABS(Bias_lambda_Adp[:]);
BiasOVL3_Adp=ABS(Bias_delta_Adp[:]);


MSE11=MSE1[:];
MSE22=MSE2[:];
MSE33=MSE3[:];

length_OVL1_Adp=Length_rho_Adp[:];
length_OVL2_Adp=Length_lambda_Adp[:];  
length_OVL3_Adp=Length_delta_Adp[:]; 

coverage1_Adp=COV1_Adp[:];
coverage2_Adp=COV2_Adp[:];
coverage3_Adp=COV3_Adp[:];



 ****formatting the output *******;

*print Lower_rho_RSS    exact_rho  upper_rho_RSS;


Bias=J(3,1);Length=J(3,1);coverage=J(3,1); MSE=J(3,1,0);

Bias[1,1]=(BiasOVL1_Adp ); 	Bias[2,1]=(BiasOVL2_Adp );	Bias[3,1]=(BiasOVL3_Adp );

MSE[1,1]= MSE11; 	        MSE[2,1]= (MSE22 );	    MSE[3,1]= (MSE33 );


Length[1,1]=(length_OVL1_Adp ); 	Length[2,1]=(length_OVL2_Adp );	Length[3,1]=(length_OVL3_Adp );
					 
coverage[1,1]=(COV1_Adp[:]); 	coverage[2,1]=(COV2_Adp[:] );	    coverage[3,1]=(COV3_Adp[:] );
					  
names={rho,lambda,delta};
					 
Print "Results from T3";
print case  n1 m1;
print names  bias  "    "   MSE   "    " Length "    "   coverage  ;

	
quit;







&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Sep 2023 19:47:49 GMT</pubDate>
    <dc:creator>Salah</dc:creator>
    <dc:date>2023-09-13T19:47:49Z</dc:date>
    <item>
      <title>Subroutine error</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Subroutine-error/m-p/894153#M6061</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using my previous code which is working fine, just changed the density. I keep getting warning messages "&lt;FONT color="#339966"&gt;WARNING: Invalid argument resulted in missing value result."&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I check the line that caused this issue and printed it to see all values, but I found no problem with it.&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Can you please help me figure out it and solve this issue.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Thank you&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc iml;


*seed=0;  NN=10;

theta1=2;   theta2=10;   del=3;

case=2; n1=30; m1=15;   k=J(m1,1,0); K[m1]=n1-m1;       L=K;    	n2=n1;     m2=m1;	

**********************************************************************************************************************;

***********************  		Exact OVL 		*******************************;
						
						
R=(theta1/theta2); 
R_star=((m2-1)/m2)*R; 

R1=R_star;

rho_Exact=2*sqrt(R1)/(1+R1);
lambda_Exact=(2*sqrt(R1)/(1+R1))**2;
delta_Exact=1-R1**(1/(1-R1))*abs(1-1/R1);

******************************************************************************;
start Uniform_p(m,R)  global(seed);

V=J(m,1,0); U=J(m,1,0);W=J(m,1);

W=randfun(m,"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(n,m,R,theta) Global(del) ;

U=uniform_p(m,R);

Y=( log ( 1 -  (1- U)##(1/theta)  ) ) ;

X = - y ##(-1/del);

T=X[m]+2; 

Do idx=1 to m-1;
	If (( X[idx] &amp;lt; T) &amp;amp; (T &amp;lt;= X[idx+1] )) then j=idx;           
End;

If X[m]&amp;gt;T then 

		Do;
			W=Uniform_p(m-j,R);

			WE= (1 - Exp(-1/T##del));

			X_m_j =( -1/ ( log ( 1 -  ( (1- W)##(1/theta) ) # WE ) ) )##del;

			X_Adptive= X[1:j]//X_m_j;
			Rm=n-m-sum(R[1:J]);
			R2=J(m-j,1,0);R2[m-J]=Rm;
			newR=R[1:j]//R2;

		End;
	
Else 

		Do;
			j= m;
			newR=R;
			X_Adptive=X;
		End;

P1=[X_Adptive,j,newR,y];

return P1;
Finish;

********** Subroutine to compute the MLEs  **************;
*********************************************************;
						
start MLE(X,n,m,R,J);

	Part=1-Exp(- 1/X##(-del));

	deno = R[m]*log(part[m])+ sum (log(part)) + sum( (R#log(part))[1:J] ) ;
		
	Theta_MLE = (- m/deno); 
	
return(Theta_MLE);
finish;

******************************************************************************************;

theta1_Adp=J(NN,1,0); theta2_Adp=J(NN,1,0);H_Adp=J(NN,1,0);
R_star_Adp=J(NN,1,0);


rho_star_Adp=J(NN,1,0);Var_rho_Adp=J(NN,1,0);Bias_rho_Adp=J(NN,1,0);
lambda_star_Adp=J(NN,1,0);Var_lambda_Adp=J(NN,1,0);Bias_lambda_Adp=J(NN,1,0);
delta_star_Adp=J(NN,1,0);Var_delta_Adp=J(NN,1,0);Bias_delta_Adp=J(NN,1,0);
MSE_rho_Adp=J(NN,1,0);MSE_lambda_Adp=J(NN,1,0);MSE_delta_Adp=J(NN,1,0);

Lower_rho_Adp=J(NN,1);Upper_rho_Adp=J(NN,1);Length_rho_Adp=J(NN,1);
Lower_lambda_Adp=J(NN,1);Upper_lambda_Adp=J(NN,1);Length_lambda_Adp=J(NN,1);
Lower_delta_Adp=J(NN,1);Upper_delta_Adp=J(NN,1);Length_delta_Adp=J(NN,1);
COV1_Adp=J(NN,1,0);COV2_Adp=J(NN,1,0);COV3_Adp=J(NN,1,0);***COVi= stands for coverage of OVLi, i=1,2,3**;
var_rho_Adp=J(NN,1,0);var_lambda_Adp=J(NN,1,0);var_delta_Adp=J(NN,1,0);

MSE1=J(NN,1,0);MSE2=J(NN,1,0);MSE3=J(NN,1,0);

Do JJ=1 to NN;

		X=J(m1,1,0);Y=J(m2,1,0); X_ADP=J(m1,1,0);Y_ADP=J(m2,1,0);


		*********************************************************************;

		
		AdaptiveResX=Adaptive(n1,m1,K,theta1);
		X_ADP=AdaptiveResX$1;
		J1=AdaptiveResX$2;
		newK=AdaptiveResX$3;
		y=AdaptiveResX$4;print y;
		K=newK;	
		
		AdaptiveResY=Adaptive(n2,m2,L,theta2);
		Y_ADP=AdaptiveResY$1;
		J2=AdaptiveResY$2;
		newL=AdaptiveResY$3;
		L=newL;	

		Theta1_Adp[JJ] = MLE(X_ADP,n1,m1,K,J1);
		Theta2_Adp[JJ] = MLE(Y_ADP,n2,m2,L,J2);

		
		R_star_Adp[JJ]=(m2-1)/m2*(theta1_Adp[JJ]/theta2_Adp[JJ]);
End;


** The estimated values of the OVL **;

rho_star_Adp=2#sqrt(R_star_Adp)#(1+R_star_Adp)##(-1);
lambda_star_Adp=rho_star_Adp##2;
delta_star_Adp=1-R_star_Adp##(1/(1-R_star_Adp))#abs(1-1/R_star_Adp);

****** Asymptotic Variance of the Overlap ********;

var_rho_Adp=R_star_Adp#(1-R_star_Adp)##2/(1+R_star_Adp)##4#(m1+m2-1)/(m1*(m2-2));

var_lambda_Adp=16#R_star_Adp##2#(1-R_star_Adp)##2/(1+R_star_Adp)##6#(m1+m2-1)/(m1*(m2-2));

var_delta_Adp=(m1+m2-1)/(m1*(m2-2))#R_star_Adp##(2/(1-R_star_Adp))#(log(R_star_Adp))##2/(1-R_star_Adp)##2;

******   Asymptotic Bias of the Overlap   ********;


Bias_rho_Adp=(m1+m2-1)/( m1*(m2-2))# sqrt(R_star_Adp)# ( 3#R_star_Adp##2-6#R_star_Adp-1)/( 4#(1+R_star_Adp)##3 );

Bias_lambda_Adp=(m1+m2-1)/(m1*(m2-2))#4#R_star_Adp##2#(R_star_Adp-2)/(1+R_star_Adp)##4; 

H_Adp= R_star_Adp##(1/(1-R_star_Adp))  # ( R_star_Adp#(2#R_star_Adp-log(R_star_Adp)-2)#log(R_star_Adp) - (R_star_Adp-1)##2   )/(R_star_Adp-1)##3;

H_Adp=R_star_Adp##2 #  R_star_Adp##((2#R_star_Adp-1)/(1-R_star_Adp)) # (  R_star_adp #
		(2#R_star_Adp-log(R_star_Adp)-2)#log(R_star_Adp) - (R_star_Adp-1)##2   )/(R_star_Adp-1)##3;


Do JJ=1 to NN;
	if (R_star_Adp[JJ] &amp;gt; 1) then Bias_delta_Adp[JJ]=(m1+m2-1)/(2*m1*(m2-2))* H_Adp[JJ]/2;
	if (R_star_Adp[JJ] &amp;lt; 1) then Bias_delta_Adp[JJ]=-(m1+m2-1)/(2*m1*(m2-2))* H_Adp[JJ]/2;

End;

Theta1_h=theta1_Adp[:];
Theta2_h=theta2_Adp[:];

Bias_rho=Bias_rho_Adp[:]; Bias_lambda=Bias_lambda_Adp[:]; Bias_delta=Bias_delta_Adp[:]; 


** I used MSE below b/c it provides smaller MSE values;

MSE1 = ( rho_star_Adp    - rho_Exact )##2;
MSE2 = ( lambda_star_Adp - lambda_exact)##2;
MSE3 = ( delta_star_Adp  - delta_exact)##2;


Var1= Var_rho_Adp[:];
Var2= Var_lambda_Adp[:];
Var3= Var_delta_Adp[:];


**** Interval estimation using Asymptotic technique ****;

Do JJ=1 to NN;

***************************		 		OVL1			*****************************;

Lower_rho_Adp[JJ] = rho_star_Adp[JJ] -  Bias_rho_Adp[JJ] - 1.96*sqrt(Var_rho_Adp[JJ]);
Upper_rho_Adp[JJ] = rho_star_Adp[JJ] -  Bias_rho_Adp[JJ] + 1.96*sqrt(Var_rho_Adp[JJ]);

Length_rho_Adp[JJ]=Upper_rho_Adp[JJ]-Lower_rho_Adp[JJ]; 

If ( (rho_exact &amp;gt;= Lower_rho_Adp[JJ])&amp;amp; (rho_exact &amp;lt;= upper_rho_Adp[JJ]) ) then COV1_Adp[JJ]=1;* COV is the coverage;
*************************************************************************************;

***************************		 		OVL2			*****************************;


Lower_lambda_Adp[JJ] = lambda_star_Adp[JJ]     - Bias_lambda_Adp[JJ] - 1.96*sqrt(Var_lambda_Adp[JJ]);
Upper_lambda_Adp[JJ] = lambda_star_Adp[JJ]     - Bias_lambda_Adp[JJ] + 1.96*sqrt(Var_lambda_Adp[JJ]);

Length_lambda_Adp[JJ]= Upper_lambda_Adp[JJ] - Lower_lambda_Adp[JJ]; 

If ( (lambda_exact  &amp;gt;= Lower_lambda_Adp[JJ])&amp;amp; (lambda_exact &amp;lt;= upper_lambda_Adp[JJ]) ) 
										then COV2_Adp[JJ]=1; 

**************************************************************************************;

***************************		 		OVL3			******************************;


Lower_delta_Adp[JJ] = delta_star_Adp[JJ]   - Bias_delta_Adp[JJ] - 1.96*sqrt(Var_delta_Adp[JJ]);
Upper_delta_Adp[JJ] = delta_star_Adp[JJ]   - Bias_delta_Adp[JJ] + 1.96*sqrt(Var_delta_Adp[JJ]);

Length_delta_Adp[JJ]= Upper_delta_Adp[JJ]  -Lower_delta_Adp[JJ];

If ( (delta_exact &amp;gt;= Lower_delta_Adp[JJ])&amp;amp; (delta_exact &amp;lt;= upper_delta_Adp[JJ]) ) 
					                    then COV3_Adp[JJ]=1; 


end;

***************** 						END Of Simulations	 					************************;
********************************************************************************************************;

BiasOVL1_Adp=ABS(Bias_rho_Adp[:]); ** why I added 0.001 is explained above ;
BiasOVL2_Adp=ABS(Bias_lambda_Adp[:]);
BiasOVL3_Adp=ABS(Bias_delta_Adp[:]);


MSE11=MSE1[:];
MSE22=MSE2[:];
MSE33=MSE3[:];

length_OVL1_Adp=Length_rho_Adp[:];
length_OVL2_Adp=Length_lambda_Adp[:];  
length_OVL3_Adp=Length_delta_Adp[:]; 

coverage1_Adp=COV1_Adp[:];
coverage2_Adp=COV2_Adp[:];
coverage3_Adp=COV3_Adp[:];



 ****formatting the output *******;

*print Lower_rho_RSS    exact_rho  upper_rho_RSS;


Bias=J(3,1);Length=J(3,1);coverage=J(3,1); MSE=J(3,1,0);

Bias[1,1]=(BiasOVL1_Adp ); 	Bias[2,1]=(BiasOVL2_Adp );	Bias[3,1]=(BiasOVL3_Adp );

MSE[1,1]= MSE11; 	        MSE[2,1]= (MSE22 );	    MSE[3,1]= (MSE33 );


Length[1,1]=(length_OVL1_Adp ); 	Length[2,1]=(length_OVL2_Adp );	Length[3,1]=(length_OVL3_Adp );
					 
coverage[1,1]=(COV1_Adp[:]); 	coverage[2,1]=(COV2_Adp[:] );	    coverage[3,1]=(COV3_Adp[:] );
					  
names={rho,lambda,delta};
					 
Print "Results from T3";
print case  n1 m1;
print names  bias  "    "   MSE   "    " Length "    "   coverage  ;

	
quit;







&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 19:47:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Subroutine-error/m-p/894153#M6061</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2023-09-13T19:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Subroutine error</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Subroutine-error/m-p/894154#M6062</link>
      <description>&lt;P&gt;Show us the entire LOG for this PROC IML so we can see where the error appeared. Please copy the log as text and paste it into the window that appears when you click on the &amp;lt;/&amp;gt; icon.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PaigeMiller_0-1663012019648.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75161i0E71B1489A6C9839/image-size/large?v=v2&amp;amp;px=999" role="button" title="PaigeMiller_0-1663012019648.png" alt="PaigeMiller_0-1663012019648.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 19:53:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Subroutine-error/m-p/894154#M6062</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-09-13T19:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: Subroutine error</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Subroutine-error/m-p/894160#M6063</link>
      <description>&lt;P&gt;Looking at the log is essential to understanding errors. In this case, the log tells you&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WARNING: Invalid argument resulted in missing value result.

 count     : number of occurrences is 15
 operation : ## at line 72 column 1
 operands  : y, _TEM1002
Y     15 rows      1 col     (numeric)

_TEM1002      1 row       1 col     (numeric)

 -0.333333

 statement : ASSIGN at line 72 column 1
 traceback : module ADAPTIVE at line 72 column 1
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and Line 72 is the statement&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;72 X = - y ##(-1/del);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The _TEM1002 variable is the temporary expression in parentheses, so apparently&lt;BR /&gt;(-1/del) = -0.3333&lt;BR /&gt;Apparently, 15 values in the Y vector are nonpositive. The expression&amp;nbsp;&lt;BR /&gt;y##(-1/del)&lt;BR /&gt;is undefined when y &amp;lt; = 0 and the power is a floating point number.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If DEL is an integer, you can rewrite the expression as&lt;BR /&gt;X = -1/ x##del;&lt;/P&gt;
&lt;P&gt;which should be valid for y ^= 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 20:02:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Subroutine-error/m-p/894160#M6063</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2023-09-13T20:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Subroutine error</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Subroutine-error/m-p/894218#M6064</link>
      <description>&lt;P&gt;Thank you all for your reply, "del" is not an integer (It could but not necessary).&lt;/P&gt;&lt;P&gt;I am thinking of adding an if statement&amp;nbsp;"If Y&amp;lt;=0 then Y=0.0001" OR "If y&amp;lt;=0 then Go to Step 1" were "Step 1" is defined to take me back to&amp;nbsp; the beginning of the simulation. However, I tried to change the seed and everything is working fine.&amp;nbsp; Not sure if I am fooling myself or not. Please advise if any of these ideas are legitimate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 05:58:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Subroutine-error/m-p/894218#M6064</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2023-09-14T05:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Subroutine error</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Subroutine-error/m-p/894234#M6065</link>
      <description>&lt;P&gt;&amp;gt;&amp;nbsp;&lt;EM&gt;I am thinking of adding an if statement&amp;nbsp;"If Y&amp;lt;=0 then Y=0.0001" OR "If y&amp;lt;=0 then Go to Step 1"&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Because Y is a vector, some elements can be negative whereas others can be positive. Therefore, you must be careful. An IF-THEN statement checks whether ALL elements of vector satisfy the logical condition. See&amp;nbsp;&lt;A href="https://blogs.sas.com/content/iml/2015/01/26/if-then-matrix.html" target="_blank"&gt;IF-THEN logic with matrix expressions - The DO Loop (sas.com)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is always better to understand WHY a situation is occurring rather than try to patch it up after it has occurred. I don't know what distribution you are trying to simulate, but I can tell you that the express&lt;/P&gt;
&lt;P&gt;y = log ( 1 - (1- U)##(1/theta) ) ;&lt;/P&gt;
&lt;P&gt;is negative when U is in the interval (0,1) and theta &amp;gt; 0.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 09:50:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Subroutine-error/m-p/894234#M6065</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2023-09-14T09:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: Subroutine error</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Subroutine-error/m-p/894317#M6068</link>
      <description>&lt;P&gt;Thank you for your suggestions and help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe I know the reason behind it.&amp;nbsp; It depends on what data is simulated some of the values of Y are extremely small, not many but even one value can cause a damage!&lt;/P&gt;&lt;P&gt;I noticed that for some seed values I may get no outliers&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 16:59:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Subroutine-error/m-p/894317#M6068</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2023-09-14T16:59:08Z</dc:date>
    </item>
  </channel>
</rss>

