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 (November 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 16 Nov 2009 16:13:00 +0000
Reply-To:   toby dunn <tobydunn@HOTMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   toby dunn <tobydunn@HOTMAIL.COM>
Subject:   Re: Comparing Dates From 2 Different Files
Comments:   To: harrypotterdhf@earthlink.net
In-Reply-To:   <200911161559.nAGBmMnL011920@malibu.cc.uga.edu>
Content-Type:   text/plain; charset="iso-8859-1"

Proc SQL ; Create Table Need ( Drop = Diff ) As Select A.ID , A.Date As Date1 , B.Date As Date2 , ABS( A.Date - B.Date ) As Diff From One As A , Two As B Where A.ID = B.ID Group By A.ID , A.Date Having Min( Diff ) = Diff ; Quit ;

Toby Dunn

"Don't bail. The best gold is at the bottom of barrels of crap." Randy Pausch

"Be prepared. Luck is where preparation meets opportunity." Randy Pausch

> Date: Mon, 16 Nov 2009 10:59:06 -0500 > From: harrypotterdhf@EARTHLINK.NET > Subject: Comparing Dates From 2 Different Files > To: SAS-L@LISTSERV.UGA.EDU > > I have SAS 8.21 installed at my site. I am comparing dates from customers > from 2 different files. I want to take the customer date from the 2nd file > closest to the date in the 1st file. A customer in the 1st file might have 2 > different dates but I want the date in the 2nd file closest to each: > > Example Input: > > File 1 > > Customer ID date1 > 1 01/06/09 > 1 02/07/09 > 2 02/01/09 > > File 2 > > Customer ID date2 > 1 03/07/09 > 1 04/09/09 > 1 04/30/09 > 2 03/06/09 > 2 07/07/09 > > Desired Output: > > Customer date1 date2 > 1 01/06/09 03/07/09 > 1 02/07/09 03/07/09 > 2 02/01/09 03/06/09 _________________________________________________________________ Bing brings you maps, menus, and reviews organized in one place. http://www.bing.com/search?q=restaurants&form=MFESRP&publ=WLHMTAG&crea=TEXT_MFESRP_Local_MapsMenu_Resturants_1x1


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