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 (April 2007, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 5 Apr 2007 16:46:49 -0400
Reply-To:   "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:   Re: Work with Duplicates: Proc SQL

On Wed, 4 Apr 2007 12:09:24 -0700, sdlenter <sdlentert@AOL.COM> wrote:

>Using Proc SQL >I have a file and I need to work with duplicates only: >Example: >I need to Count duplicates by Movie (actress, actor, song and money) >so the four fields (actress, actor, song and money) have to match. > >the non-duplicate fields I need to extract into a seperate file....

Test data:

data have; input actress actor song money; cards; 1 1 1 1 2 2 2 2 1 1 1 1 ;

Then, in the PROC SQL step:

create table multiple as select *, count(*) as many from have group by actress, actor, song, money having many gt 1;

create table single as select * from have group by actress, actor, song, money having count(*) eq 1;


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