home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!paladin.american.edu!auvm!SWIRL.MONSANTO.COM!GIBES
- Message-ID: <9208281329.AA17498@tin.monsanto.com>
- Newsgroups: bit.listserv.sas-l
- Date: Fri, 28 Aug 1992 08:29:08 -0500
- Reply-To: Kernon Gibes <gibes@SWIRL.MONSANTO.COM>
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: Kernon Gibes <gibes@SWIRL.MONSANTO.COM>
- Subject: RE: print dup records
- Comments: To: SAS-L@uga.cc.uga.edu@tin.monsanto.com
- Comments: cc: GIBES@tin.monsanto.com
- Lines: 35
-
- CONTENT: Response (to printing duplicate records only)
- SUMMARY: A possible SQL approach
- REL/PLTF: 6.06+/n.a.
- E-ADDR: gibes@swirl.monsanto.com
- NAME: Kernon Gibes
- DATE: 28 August 1992
-
- Regarding:
-
- >I wonder if anyone knows a "easy" way to print duplicate records in a
- >data set. Proc sort has an option to drop duplicates, but nothing to
- >keep the duplicates only. I suppose I can use a do loop in DATA step
- >to check for duplicates, but is there an easier way? We are running
- >SAS607 on MVS, and CMS.
-
- and, from Ray,
-
- >That was an "easy" one. And now for the SQL answer. Howard ?
-
- Well, I'm no Howard, but:
-
- proc sql;
- select * from org
- group by idno
- having count(idno) > 1
- ;
- quit;
-
- will mimic Ray's solution except that if the records are PURE
- duplicates, each IDNO will be printed only once. If the records are
- only duplicates with respect to IDNO but other variables differ, the
- above SQL code will list ALL the records for each IDNO having duplicate
- values. If there is more than one key, the code, like Ray's, would have
- to be expanded. It wasn't clear to me exactly how extensive the
- duplicate record situation was.
-