Date: Wed, 12 Mar 2008 07:17:32 -0700
Reply-To: chao <soulas.gaetan@NEUF.FR>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: chao <soulas.gaetan@NEUF.FR>
Organization: http://groups.google.com
Subject: Re: Coding question, please help!
Content-Type: text/plain; charset=ISO-8859-1
On Mar 12, 2:41 pm, Xuhong <zhuxuhong2...@gmail.com> wrote:
> Hello, folks,
>
> I have one problem and am stucked at a certain point. If somebody
> could give me a hint, it will be great. Thanks.
> The dataset has been sorted by member_ID and Service_date. And what I
> want is to delete those dates that are within 10 days and only keep
> the first one. I simplified the dataset as following.
>
> /***input ***/
> member_ID Service_date
> 12345 09/29/2004
> 12345 10/01/2004
> 12345 10/03/2004
> 12345 10/01/2005
> 12345 10/03/2005
> 52132 06/07/2003
> 55225 05/13/2004
> 55225 05/18/2004
> 55225 03/11/2005
>
> /**Desired output***/
> 12345 09/29/2004
> 12345 10/01/2005
> 52132 06/07/2003
> 55225 05/13/2004
> 55225 03/11/2005
Hello,
I hope I can help you with this code :
data table2 (drop = date1);
set table1;
retain date1;
if _n_ = 1 or Service_date - date1 > 10 then do;output;
date1 =
service_date;
end;
run;
Is that OK ?
Gaétan
|