Finding closest date to a specified date in sas dataset? -


based on data assist me - making program contains

test_date closest delivery_date.

delivery_date 11/16/2011

test_date 21/nov/2011 10/nov/2011 5/oct/2010

thanks in advance

can't answer without more information, if have 2 datasets , 1 row per date, , actual date variables, solution this:

create table finaldsn   select a.*   , b.*   , a.delivery_date-b.test_date days   , abs(calculated days) absdays   , min(calculated absdays)as close   dsna   full join   dsnb b   on a.subject=b.id   a.delivery_date ne . , b.ltest_datebdt ne .  , b.id in (select distinct subject   dsna)   group a.subject, a.delivery_date   having calculated absdays=calculated close  ; quit; 

this following paper: http://www.lexjansen.com/pharmasug/2003/coderscorner/cc001.pdf presents few other solutions.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -