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 (December 2010, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 23 Dec 2010 19:04:00 -0500
Reply-To:     msz03@albany.edu
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Mike Zdeb <msz03@ALBANY.EDU>
Subject:      Re: merge within 30 days by id
Comments: To: Kim Brown <kibrown@LADHS.ORG>
Content-Type: text/plain;charset=iso-8859-1

hi ... how about SQL ...

proc sql; create table wn30 as

select a.id, a.fac as afac, a.admdate as admita, b.fac as bfac, b.admdate as admitb

from a,b

where a.id eq b.id and abs(admita - admitb) le 30; quit;

-- Mike Zdeb U@Albany School of Public Health One University Place (Room 119) Rensselaer, New York 12144-3456 P/518-402-6479 F/630-604-1475

> Hi all > I'm working with version 9.1 in XP pro platform. > I have the following code, it's not working > > data A; > input id fac :$ admdate :mmddyy10.; > format admdate mmddyy10.; > datalines; > 001 15 6/3/2010 > 002 15 2/16/2010 > 003 25 11/10/2010 > ; > run; > > data B; > input id fac :$ admdate :mmddyy10.; > format admdate mmddyy10.; > datalines; > 001 54 11/12/2010 > 002 23 3/8/2010 > 003 23 10/8/2008 > > ; > run; > > I'm trying to merge to dataset if ReAdm4 is within 30 > day for ReAdm5 dataset; > ; > Proc sort data=A out=readm4 (keep=pat_id disch_date); > by pat_id disch_date; > run;*facility A; > > Proc sort data=B out=readm5 (keep=pat_id disch_date); > by pat_id disch_date; > run;*facility B; > > *Merge if within 30 days after their discharge date; > data final; > merge reAdm4 (in=a) and reAdm5 (in=b); > by pat_id; > if (A.disch_date <= ( Intnx( 'Month' , B.disch_date , 1 , 'E' ) ); > run; > > Any help is appreciated. > Thanks, > Kim >


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