Date: Thu, 13 Dec 2007 05:56:06 -0800
Reply-To: Takeadoe <mtonkovich@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Takeadoe <mtonkovich@MSN.COM>
Organization: http://groups.google.com
Subject: finding duplicates - with a twist
Content-Type: text/plain; charset=ISO-8859-1
Dear Group Members - The list is loaded with all manner of handy
programs to flag duplicates. I've tested those below and they work
great. However, I need to take this a step further. Each record
within each duplicate group (there may be as many as 7 dups according
to Last Name, First Name, and DOB) will have a date/time stamp. I
want to create a new field that ranks each record within the duplicate
group according to date, from oldest to most recent (first record in
would get a 1 and last record in would get a 7).
Perhaps a bit of background will help. The database contains records
of hunter-harvested deer. I want to identify (by First Name, Last
Name, and DOB) hunters that harvested multiple deer and use the date
of harvest to assign a value - 1st deer, 2nd deer, 3rd deer, and so
on.
Any help is greatly appreciated.
Mike
sample code to id duplicates follows... If you can modify this, to
help with my request, that would be great.
data mydata;
input id;
cards;
123
123
111
136
run;
proc sort data=mydata; by id; run;
data nodouble double; set mydata;
by id;
if first.id and last.id then output nodouble;
else output double;
run;
data out;
set mydata;
by id;
flag = (first.id and last.id) ;
run ;