another try

回答: 太對了, 謝謝!Janezhu2010-07-13 18:41:54

proc sort data=dataset; by name date; run;

data dataset;
set dataset;
by name date;
if first.name then do;
counter=0;
retain counter;
end;
counter+1;
run;

proc sql;
select name, avg(ret) as avg_ret_1 from dateset
group by name;
run;

proc sql;
select name, avg(ret) as avg_ret_2 from dateset
where counter gt 1
group by name;
quit;

所有跟帖: 

謝謝!非常感謝! 你太可愛了 -Janezhu- 給 Janezhu 發送悄悄話 (0 bytes) () 07/13/2010 postreply 19:48:15

請您先登陸,再發跟帖!