Hello If I have one if statement then the code works ok however, the result is wrong, If I added the two if statements, then the code goes into indefinite mode and I had to terminate the SAS. My real life data is not big just 24 observations, I also tried to take 5 observations instead of the 24 but still the answer would be wrong. I would appreciate any suggestions. proc iml;
X={0.2, 0.3, 0.5, 0.5, 0.5, 0.5, 0.6, 0.6, 0.7, 0.7, 0.7, 0.8, 0.8, 1.0, 1.0, 1.0, 1.0, 1.1, 1.3, 1.5, 1.5,
1.5, 1.5, 2.0, 2.0, 2.2, 2.5, 3.0, 3.0, 3.3, 3.3, 4.0, 4.0, 4.5, 4.7, 5.0, 5.4, 5.4, 7.0, 7.5, 8.8, 9.0,
10.3, 22.0, 24.5};
Y=1/sqrt(X);
Call Sort(Y);
n=nrow(Y);
m=2;
sum=0;
do i=1 to n;
*if (i<=m) then i=m+1; if (i<=m) then Y[i-m]=Y[1];
if i >= n-m then Y[i+m]=Y[n];
*sum = sum + 1/(Y1[i+m]-Y1[i-m]);
XXX = Y1[i+m]-Y1[i-m]; print XXX;
end;
... View more