Date: Tue, 17 Mar 2009 20:02:32 -0400
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: Delete Duplicated Records based on multiple columes, Thanks!
Nancy,
I don't think there is a perfect solution, as too much could have gone
wrong with your data.
One possibility might be to pre-process your data, like:
proc sort data=have;
by last_name first_name birthday
descending collected_day
result_lab lab_number;
run;
data want (drop=in_:);
set have (ren=(address=in_address
city=in_city
state=in_state));
by last_name first_name birthday;
retain address city state;
if first.birthday then do;
call missing(address);
call missing(city);
call missing(state);
end;
if missing(address) then address=in_address;
if missing(city) then address=in_address;
if missing(state) then state=in_state;
run;
data want;
set want;
by last_name first_name birthday
collected_day
result_lab lab_number;
if last.lab_number then output;
run;
HTH,
Art
-------
On Tue, 17 Mar 2009 11:50:10 -0700, Nancy <nancy0318@GMAIL.COM> wrote:
>I want to delete Duplicated records based on same ( last name, first
>name, birthday, collected day, result, lab, lab number ) .At same time
>I want to keep as much as more inforamtion for the other columes such
>as address, city and state.
>
>Can anyone give me some hint about how to make this efficiency?
>
>Thank you so much!
>
>Nancy
|