Date: Wed, 10 Jun 2009 11:40:52 +0530
Reply-To: mahesh kumar peesari <peesari.mahesh@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: mahesh kumar peesari <peesari.mahesh@GMAIL.COM>
Subject: Re: data of last visits
In-Reply-To: <0f5eccd3-0da2-4f43-9f08-576a8d7724f4@e20g2000vbc.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Hi ,
Try This.....
data have ;
input patientid visit date date9.;
format date date9.;
cards;
1 0 12Sep2008
1 1 11Aug2006
1 2 07May2007
2 0 04Oct2006
2 2 20Feb2008
3 0 15Mar2007
3 1 28Feb2007
;
run;
proc sort data=have;
by patientid;
run;
data want ;
set have;
by patientid;
if last.patientid;
run;
proc print;
run;
Regards,
Mahesh P
On Wed, Jun 10, 2009 at 11:27 AM, shashi <shashi2707@gmail.com> wrote:
> Hi All,
>
> The data looks like:
>
> patientid visit date
> 1 0 12Sep2008
> 1 1 11Aug2006
> 1 2 07May2007
> 2 0 04Oct2006
> 2 2 20Feb2008
> 3 0 15Mar2007
> 3 1 28Feb2007
>
>
>
> The data required from the above is:
>
> patientid visit date
> 1 2 07May2007
> 2 2 20Feb2008
> 3 1 28Feb2007
>
>
> i.e., the data of the last visits of the patients is required.
>
> Could anybody help on this? Thanks in advance.
>
--
Jack Of All Trades....But Master Of NONE....
|