For me, I would like to use PROC SQL ,because it is simple.
Actually Data Step also could make it simple as SQL.
data have;
input id date code;
cards;
009 123195 03
009 101595 01
009 090995 07
033 101095 07
033 101095 03
033 090995 02
033 051894 01
033 010594 07
045 122195 06
045 103195 05
045 102195 05
;
run;
proc sort data=nodupkey_data;
by id descending date;
run;
data want;
set have;
by id descending date;
if first.id then n=0;
n+first.date;
if n=1;
drop n;
run;
... View more