哇,谢谢大神!!提供了很清晰的思路~就是还有一点点问题,我按照你的代码跑出来total都是0……不知道是哪里有问题额。程序没有报错。
data test;
set hw5(drop = eventid name location newdate2str location1);
array myar(*) F8 - F36;
startyear =1978;
endyear =2006;
if start < startyear then start = startyear;
start_idx = start - startyear + 1;
if end > endyear then end = endyear;
end_idx = end - startyear + 1;
do i = start_idx to end_idx;
total+myar(i);
end;
put total=;
run;
是不是do语句有问题?