求高手解决sas数组缺失的疑惑。为什么我下面代码的结果数组counts的第一行缺失啊?!求解决。十分感谢。
需求:记录第一次超过h的count值,经过100次重复求其均值。代码如下:
data original;
do i=1 to 2000;
x=rannor(0);
output;
end;
run;
data a;
a=11.25;b=0.2;
array counts{*} count1-count100;
do m=1 to 100;
cn=0;tn=0;k=0.017;flag=0; count=0;
do j=1 to nobs;
n=round(ranuni(1)*nobs);
set original nobs=nobs point=n;
if (cn+x-k) gt 0 then do;
cn=cn+x-k;tn=tn+1;
if tn gt 51 then tn=51;
h=a+b*log(tn);
if cn>h then do;flag=1;output;leave;end;
end;
else do;
cn=0; tn=0;
end;
count=count+1;
end;
counts[m]=count+1;
end;
stop;
ARL=mean(of counts{*});
ARLSERL=std(of counts{*})/sqrt(100);
put ARL= ARLSERL=;
run;
部分结果见下: