LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2005, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 9 Sep 2005 08:25:10 -0700
Reply-To:   "Terjeson, Mark (IM&R)" <Mterjeson@RUSSELL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Terjeson, Mark (IM&R)" <Mterjeson@RUSSELL.COM>
Subject:   Re: how to keep the duplicate records only?
Content-Type:   text/plain; charset="US-ASCII"

Hi Wei,

Here is one method I like to use:

* create sample dataset to work with ; data sample; name ='Barney '; hometown = 'Graniteville '; amount = 101; flag = 'A'; output; name ='Betty '; hometown = 'ChrystalSprings'; amount = 102; flag = '1'; output; name ='BamBam '; hometown = 'Bedrock '; amount = 103; flag = 'B'; output; name ='BamBam '; hometown = 'Bedrock '; amount = 203; flag = 'B'; output; name ='BamBam '; hometown = 'Bedrock '; amount = 303; flag = 'B'; output; name ='Wilma '; hometown = 'Bedrock '; amount = 104; flag = '2'; output; name ='Fred '; hometown = 'Slab City '; amount = 105; flag = 'C'; output; name ='Pebbles '; hometown = 'Bedrock '; amount = 106; flag = '3'; output; name ='Pebbles '; hometown = 'Bedrock '; amount = 206; flag = '3'; output; name ='Dino '; hometown = 'Bedrock '; amount = 107; flag = 'D'; output; name ='Mr.Slate'; hometown = 'Marblemount '; amount = 108; flag = '4'; output; run;

proc sort data=sample; by name; run;

data singles multiples; set sample; by name; if first.name and last.name then output singles; else output multiples; run;

Hope this is helpful.

Mark Terjeson Senior Programmer Analyst, IM&R Russell Investment Group

Russell Global Leaders in Multi-Manager Investing

On Thu, 8 Sep 2005 17:58:11 -0700, wei yi <wy78712@YAHOO.COM> wrote:

>Hello, All >I have a dataset with some duplicate records, I know >to use nodupkey to exclude the duplicate records. >But how I could keep all these duplicate records in a >file? > >Thanks, >Wei > >__________________________________________________ >Do You Yahoo!? >Tired of spam? Yahoo! Mail has the best spam protection around >http://mail.yahoo.com


Back to: Top of message | Previous page | Main SAS-L page