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;
2025 SAS Hackathon: There is still time!
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!