From: Jinto83 on
Hi,

proc sort nodup removes the second duplicate record but still keeps the first record.

In my opinion, the duplicate data are highly suspicious and I wish to remove BOTH of the duplicates. How to do that?



--- news://freenews.netfront.net/ - complaints: news(a)netfront.net ---
From: Tom Abernathy on
Could do it in two steps?

proc sort data=IN out=OUT outdup=DUPS nodupkey ;
by &byvars;
run;

data out;
merge out dups(in=indup);
by &byvars;
if indup then delete;
run;


On Feb 20, 8:54 pm, "Jinto83" <jint...(a)sina.com> wrote:
> Hi,
>
> proc sort nodup removes the second duplicate record but still keeps the first record.
>
> In my opinion, the duplicate data are highly suspicious  and I wish to remove BOTH of the duplicates. How to do that?
>
> --- news://freenews.netfront.net/ - complaints: n...(a)netfront.net ---

From: Barry Schwarz on
On Sat, 20 Feb 2010 20:54:02 -0500, "Jinto83" <jinto83(a)sina.com>
wrote:

>Hi,
>
>proc sort nodup removes the second duplicate record but still keeps the first record.
>
>In my opinion, the duplicate data are highly suspicious and I wish to remove BOTH of the duplicates. How to do that?

I assume you want to remove triplicates, quads, etc also. After
sorting the key variables without nodup, try a subsetting if on first
and last:

data new;
set old;
by key1 key2 ... keyn;
if first.keyn & last.keyn;
run;

--
Remove del for email
From: xlr82sas on
On Feb 21, 10:11 am, Barry Schwarz <schwa...(a)dqel.com> wrote:
> On Sat, 20 Feb 2010 20:54:02 -0500, "Jinto83" <jint...(a)sina.com>
> wrote:
>
> >Hi,
>
> >proc sort nodup removes the second duplicate record but still keeps the first record.
>
> >In my opinion, the duplicate data are highly suspicious  and I wish to remove BOTH of the duplicates. How to do that?
>
> I assume you want to remove triplicates, quads, etc also.  After
> sorting the key variables without nodup, try a subsetting if on first
> and last:
>
>     data new;
>         set old;
>         by key1 key2 ... keyn;
>         if first.keyn & last.keyn;
>     run;
>
> --
> Remove del for email

This may have syntax or typo errors

proc sql;
create
table singletons as
select
*
from
sashelp.class
group
by age
having
count(age)=1
;quit;

If you use count(age)>1 you will twins, triplets, quads....
From: S=?ISO-8859-1?Q?=C3=B8ren?= Lassen on
If the duplicate observations are very suspicious, you probably want to
put them aside somewhere for examination, e.g.:

proc sort data=have;
by a b c;
run;

data want errors;
set have;
by a b c;
if first.c and last.c then output want;
else output errors;
run;

Regards,
Søren

On Sat, 20 Feb 2010 20:54:02 -0500, Jinto83 <jinto83(a)SINA.COM> wrote:

>Hi,
>
>proc sort nodup removes the second duplicate record but still keeps the
first record.
>
>In my opinion, the duplicate data are highly suspicious and I wish to
remove BOTH of the duplicates. How to do that?
>
>
>
>--- news://freenews.netfront.net/ - complaints: news(a)netfront.net ---