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 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 19 Apr 2007 04:30:18 -0700
Reply-To:     sbarry@SBBWORKS.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Scott Barry <sbarry@SBBWORKS.COM>
Organization: http://groups.google.com
Subject:      Re: Dups and date - urgent
Comments: To: sas-l@uga.edu
In-Reply-To:  <1176935983.204528.43330@e65g2000hsc.googlegroups.com>
Content-Type: text/plain; charset="iso-8859-1"

On Apr 18, 6:39 pm, sdlenter <sdlent...@aol.com> wrote: > On Apr 18, 2:55 pm, Huang...@PRINCIPAL.COM ("Huang, JS") wrote: > > > This is an approach: > > > data Given; > > input F1 $ F2 $ F3 $ F4 $ date:yymmdd8.; > > format date mmddyy10.; > > datalines; > > ab ff gg hg 20070505 > > ab ff gg jj 20040701 > > ab fh ht kkk 20040404 > > ab ff gg gggg 20040508 > > ; > > > proc sort data=Given; > > by F1 F2 F3 date; > > run; > > > data Result; > > set Given; > > by F1 F2 F3; > > if first.F3 then output; > > run; > > > proc print; > > run; > > > ***** Output ***** > > The SAS System 16:51 > > Wednesday, April 18, 2007 4 > > > Obs F1 F2 F3 F4 date > > > 1 ab ff gg gggg 05/08/2004 > > 2 ab fh ht kkk 04/04/2004 > > > -----Original Message----- > > From: SAS(r) Discussion [mailto:S...@LISTSERV.UGA.EDU] On Behalf Of > > > sdlenter > > Sent: Wednesday, April 18, 2007 4:42 PM > > To: S...@LISTSERV.UGA.EDU > > Subject: Dups and date - urgent > > > Urgent! Need help... > > Using Dataset and Not proc SQL 'having min' function > > > I have sas dataset > > F1 F2 F3 F4 date > > ab ff gg hg 20070505 > > ab ff gg jj 20040701 > > ab fh ht kkk 20040404 > > ab ff gg gggg 20040508 > > > I need to have a table with unique records , based on F1, F2, and F3 > > field ONLY and keeping one reccord with the earliest date among the dups > > > so the new table will be > > F1 F2 F3 F4 date > > ab fh ht kkk 20040404 > > ab ff gg gggg 20040508 > > > thank you! > > > - Show quoted text - > > I cannot sort it, the dataset is too big

options compress=yes; ...your data step code to read input... * order obs with earliest date first. ; proc sort data=Given; by F1 F2 F3 date; run; * remove duplicates based on BY var list only. ; proc sort nodupkey equals data=Given; by F1 F2 F3 ; run;

Scott Barry SBBWorks, Inc.


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