LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (December 2009, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 3 Dec 2009 18:24:14 -0500
Reply-To:   Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:   Re: Duplicates and Dates
Comments:   To: sdlentertd@GMAIL.COM

The OP wrote me offline and indicated:

"I want the term date to be . (as it shows up on the duplicate Row 3)... so if there is a duplicate - grab EFFDate from the first one (earliest) and Termdate from the second one (latest or missing)."

Unless someone has a better idea, I would just do it in a data step using first. and last. E.g.,

data have; infile datalines dsd missover; input ID effdate termdate; informat effdate mmddyy10.; informat termdate mmddyy10.; format effdate termdate date9.; datalines; 1,10/14/2009,. 6,08/01/2008,01/02/2012 6,10/14/2009,. ;

proc sort data=have; by descending id effdate; run;

data want (drop=first_effdate); set have (rename=(effdate=first_effdate)); retain effdate; format effdate date9.; by descending id; if first.id then effdate=first_effdate; if last.id then output; run;

HTH, Art --------- On Thu, 3 Dec 2009 07:46:45 -0800, Sdlentertd <sdlentertd@GMAIL.COM> wrote:

> have this dataset >ID EFFDATE TERMDATE >1212 10/14/2009 . >625 08/01/2008 10/14/2009 >625 10/14/2009 . > >I need to remove duplicates but leave the duplicate's Original >EFFDATE >there. The dataset will look like this: > > >ID EFFDATE TERMDATE >1212 10/14/2009 . >625 08/01/2008 . > > >manupulating duplicate's dates Only. Duplicate is based on ID field >only. P.S. Sorting a and resorting does NOT work, it leaves the old >date in, but I need for EFFDate to be taken from one duplicate reccord >and TERMDATE to be taken from the other duplicate record. >Thank you


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