array y(14) ys2000-y2013;
这里的y(14)指y(1),y(2),y(3),...y(14),所以接下来的do循环中定义t=2000 to 2013会下标越界,
do t=2000 to 2013;
if t=obs then y(t)=1;
以上这样写,当obs=2000时,y(t)=y(2000),你定义的数组最大的成员为y(14),所以肯定出界。
应改为:
do t=1 to 14;
if y(t)=obs then y(t)=1;else y(t)=0;
output;
end;
run;
ys2000-y2013 is abbreviation for ys2000 ys2001 ys2002 ... y2013. There are 14 of them, so y(15) is long and y(13) is short. If you don't like counting, you can just use y{*} , in your case:
array y{*} ys2000-y2013;