libname ch7'C:\saswork\30535_sas\book_data\book_data\chapt7';
proc sort data=ch7.smooth;by cid month;run;
data smooth;
set ch7.smooth;
by cid;
array lags(12);
lags(1)=lag(balance);
do i=2 to 12;
lags(i)=lag(lags(i-1));
end;
do j=12 to 2 by -1;
if j gt cns then lags(j)=.;
put j=;
end;
if first.cid then do
cns=0;
do i=1 to 12;
lags(i)=.;
end;
end;
cns+1;
mean6=mean(of lags1-lags6);
mean12=mean(of lags1-lags12);
drop i j;
run;
程序如上所示,从书上看到的,不懂的是cns这一累加变量在第二个if语句中才出现,那么在第一个if 语句中如何尽心个比较?和缺失值进行比较吗?