In the above data I have "a" has duplicate. So. I want take the second duplicate value "b" to the first.
Also the missing values should be deleted if it is in between the duplicates. If the missing values are not between, then I want to take only one and not the duplicate missing value.
data have;
input id a b ;
cards;
1 1 2
2 . .
3 1 3
4 . .
5 . .
;
data temp;
set have end=last;
by id a b notsorted;
if cmiss(a,b)=2 and not last then delete;
run;
data want;
set temp;
by a notsorted;
if last.a;
run;
Register Today!
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.