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 20:24:21 -0500
Reply-To:     Paula Sims <me@HERE.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Paula Sims <me@HERE.COM>
Organization: AT&T http://yahoo.sbc.com
Subject:      Re: Remove duplicates keeping only the earliest date
Comments: To: sas-l@uga.edu
In-Reply-To:  <1175806778.470237.288980@d57g2000hsg.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

sdlenter wrote: > I am trying to Remove duplicates keeping only the earliest date > > > > example > > 1212 er tr 2007054 > 1212 er tr 20050505 > 1212 er tr 20070404 > 1215 yt uy 20050401 > so only 2nd one would be kept: 1212 er tr 20050505 >

We do this all the time at work. PROC SQL works great.

PROC SQL; CREATE TABLE TWO AS SELECT A.ID, A.VAR2, A.VAR3, A.DATE FROM ONE A WHERE A.DATE = (SELECT MAX(DATE) FROM ONE WHERE ID = A.ID);

QUIT; RUN;

Paula


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