Date: Tue, 1 Nov 2005 21:37:08 -0500
Reply-To: diskin@alum.rpi.edu
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Dennis Diskin <ddiskin@GMAIL.COM>
Subject: Re: Deleting observations including the first one
In-Reply-To: <200511020218.jA20DSJe000383@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
Md,
I think what you are asking for is below, but I'm not very sure:
proc sort data=yourdata;
by patient startdate acc;
run;
data dupes;
set yourdata;
by patient startdate acc;
if not (first.acc and last.acc);
run;
HTH,
Dennis Diskin
On 11/1/05, Md Alam <mehedisas@yahoo.com> wrote:
>
> Sample of the given dataset is as below:
>
> patient startdate acc ser tes
> ------- --------- --- --- ----
> 1 30may04 pain mild always
> 1 30may04 pain mild sometimes
> 1 30may04 pain mild always
> 1 30may04 headec mild always
> 2 15may05 headec moderate always
> 2 15may05 headec moderate sometimes
> 5 10jun03 depression mild always
> 7 16feb pain headec sometimes
> 7 18march pain headec always
>
> I need a report out of it where I will have only the observations those
> are
> curbon copy. My desired output would be as below (where startdate, acc,
> ser
> would be the same for a particular patient):
>
> patient startdate acc ser tes
> ------- --------- --- --- ----
>
> 1 30may04 pain mild always
> 1 30may04 pain mild sometimes
> 1 30may04 pain mild always
> 2 15may05 headec moderate always
> 2 15may05 headec moderate always
>
> In a nutshell What I am trying to do here is using nodupkey with by group
> to delete the duplicates and getting a subset where only the
> non duplicated observations will be available. Then creating a variable
> and
> merging it with the original dataset to get desired output. but nodupkey
> leaving the first.variable in the original dataset. Sounds my way is not
> working at all. Would anyone be kind enough to help me out? Thanks for
> your
> time.
>
|