subject date
001 12/22/2009
001 01/14/2016
001 03/20/2014
002 02/12/2007
002 01/23/2015
我只想要以下内容:
subject date
001 12/22/2009
002 02/12/2007
答案 0 :(得分:2)
与first.
一起使用副处理:
/* sort into order */ proc sort data=have ; by subject date ; run ; /* Take 1st record per subject (i.e. earliest date) */ data want ; set have ; by subject ; if first.subject ; run ;
答案 1 :(得分:1)
通过proc sql可以如下所示
proc sql;
create table want as
select * from have
group by subject
having date=min(date);
或者您可以使用proc手段
proc means data=have nway;
class subject;
var date;
output out=want(keep =id date) min(date) =date;
run;