Date: Thu, 29 Dec 2011 10:14:53 -0500
Reply-To: "Bian, Haikuo" <HBian@FLQIO.SDPS.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Bian, Haikuo" <HBian@FLQIO.SDPS.ORG>
Subject: Re: How to extract just duplicate records by certain field (in
order to investigate )?
In-Reply-To: <1325170437.19178.YahooMailNeo@web39405.mail.mud.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"
If using SQL, you don't need to worry about sorting at all:
data have;
infile cards;
input claimID $ DIAG $ ServiceDate :$20.;
cards;
55555 600.1 12/31/2010
11111 650.1 1/23/2010
11111 650.2 2/20/2010
11111 650.3 3/30/2010
44444 243.0 1/1/2010
33333 V30.1 2/1/2010
33333 650.1 4/2/2010
;
proc sql;
create table want as
select * from have
group by claimid
having count(*)>1
;
quit;
Kindly Regards,
Haikuo
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Irin later
Sent: Thursday, December 29, 2011 9:54 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: How to extract just duplicate records by certain field (in order to investigate )?
I need to check why my file have duplicate by claimID-s .
I am not sure how to make an extract of all same claimID to investigate
which other fields values differ and why for the same claimID
An input file looks like :
claimID DIAG ServiceDate
55555 600.1 12/31/2010
11111 650.1 1/23/2010
11111 650.2 2/20/2010
11111 650.3 3/30/2010
44444 243.0 1/1/2010
33333 V30.1 2/1/2010
33333 650.1 4/2/2010
The output I need would look like the following:
claimID DIAG ServiceDate
11111 650.1 1/23/2010
11111 650.2 2/20/2010
11111 650.3 3/30/2010
33333 V30.1 2/1/2010
33333 650.1 4/2/2010
Could you please give me a hand?
Thank you in advance,
Irin
-----------------------------------------
Email messages cannot be guaranteed to be secure or error-free as
transmitted information can be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The
Centers for Medicare & Medicaid Services therefore does not accept
liability for any error or omissions in the contents of this
message, which arise as a result of email transmission.
CONFIDENTIALITY NOTICE: This communication, including any
attachments, may contain confidential information and is intended
only for the individual or entity to which it is addressed. Any
review, dissemination, or copying of this communication by anyone
other than the intended recipient is strictly prohibited. If you
are not the intended recipient, please contact the sender by reply
email and delete and destroy all copies of the original message.