全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1048 0
2013-12-22
求高手解决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;
部分结果见下:
结果




二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群