Date: Thu, 7 Sep 2006 16:55:06 -0400
Reply-To: Muthia Kachirayan <muthia.kachirayan@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Muthia Kachirayan <muthia.kachirayan@GMAIL.COM>
Subject: Re: Removing Duplicates
In-Reply-To: <200609071657.k87AlFmX007120@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Vijay,
Hope this is what you expect.
Muthia Kachirayan
data a;
input id dt datetime16. loc;
datalines;
1 26MAR06:13:17:00 10
1 26MAR06:13:17:09 10
1 26MAR06:13:18:50 10
1 26MAR06:13:19:15 12
1 26MAR06:13:19:45 12
1 26MAR06:09:25:00 10
2 26APR06:09:27:00 8
2 29APR06:20:03:00 10
2 29APR06:20:05:00 10
2 29APR08:20:06:00 6
3 26APR06:09:27:00 10
3 26APR06:09:28:00 10
3 26APR06:09:29:00 10
3 26APR06:09:31:00 10
;
run;
%let diff = 100;
data b;
do until(last.id);
set a;
by id;
if first.id then output;
else if p_loc ne loc then output;
else if (p_loc = loc) and (dt - p_dt) > &diff then output;
p_loc = loc;
p_dt = dt;
end;
drop p_:;
run;