例如:
data test;
input stkcd$ year income profit;
cards;
000001 1998 66 44
000001 1999 77 55
000001 2000 88 49
000002 1998 . 55
000002 1999 88 .
000002 2000 99 90
;
run;
DATA TEST;
SET TEST;
RATE=PROFIT/INCOME;
RUN;
proc means data=test noprint;by stkcd;
output out=test(drop=_type_ _freq_) mean(RATE)=avg_income; run;
结果为:对于stkcd为000002时,依然计算了其rate的年度平均值,但由于只有一个数据,就使用了一个数据计算。
这样,我想请教,如何在计算好的表中返回实际参与平均值计算的个数。例如,对于000001来讲是3个,对于000002来讲,是1个,因为两个是缺失值。
谢谢了!



雷达卡





京公网安备 11010802022788号







