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 (March 2011, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 17 Mar 2011 13:25:13 -0400
Reply-To:     Gabriel Rosas <rosas.gabe@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Gabriel Rosas <rosas.gabe@GMAIL.COM>
Subject:      Re: Flagging Duplicates
In-Reply-To:  <16FD64291482A34F995D2AF14A5C932C0A5A4E40@MAIL002.prod.ds.russell.com>
Content-Type: text/plain; charset=ISO-8859-1

Even easier, instead of the IF, do:

flagDup=first.IDA;

It will always be 1 for the first occurance, and 0 for any others. On Mar 17, 2011 1:16 PM, "Terjeson, Mark" <Mterjeson@russell.com> wrote: > Hi Randy, > > Yes that is correct. > > Your 1 flags the first occurance of each group. > Your 0 flags the duplicates (within each group). > > > > Hope this is helpful. > > > Mark Terjeson > Investment Business Intelligence > Investment Management & Research > Russell Investments > 206-505-2367 > > > Russell > Global Leaders in Multi-Manager Investing > > > > > > > -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > Randy > Sent: Thursday, March 17, 2011 10:04 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Flagging Duplicates > > I have a large data set and I need to flag duplicates > > The data set is as follows: > > IDA > 1 > 1 > 1 > 2 > 3 > 3 > 4 > > I want the data set as follows: > > IDA flag_dup > 1 1 > 1 0 > 1 0 > 2 1 > 3 1 > 3 0 > 4 1 > > My code is as follows. Is it correct? > > data want ; set have ; > by IDA ; > if first.IDA then flag_Dup = 1 ; else flag_dup = 0 ; > run;


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