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;
another try
所有跟帖:
• 謝謝!非常感謝! 你太可愛了 -Janezhu- ♀ (0 bytes) () 07/13/2010 postreply 19:48:15