Date: Tue, 17 Apr 2012 06:28:14 -0700
Reply-To: Irin later <irinfigvam@yahoo.com>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Irin later <irinfigvam@YAHOO.COM>
Subject: Date condition
Content-Type: text/plain; charset=iso-8859-1
What I am trying to do is to find patients among those who discharged from Hospital and moved to Rehab afterwards.
My understanding is that the should be no more than 1 day between Hospital Discharge and Rehab admition date.
However , as it follows from Proc Contents, HospDischDate is SAS julian Date. Therefore I got 0 records in the output using my logic below:
Hospital:
# Variable Type Len Format Informat Label
5 AdmitDate Num 8 DATETIME22.3 DATETIME22.3 AdmitDate
12 HospDischDate Num 8
Rehab:
# Variable Type Len Format Informat Label
5 AdmitDate Num 8 DATETIME22.3 DATETIME22.3 AdmitDate
14 RehabDischDate Num 8 DATETIME22.3 DATETIME22.3 RehabDischDate
Proc SQL;
Create table Hosp_Rehab as
select h.memberid, h.HospDischDate, r.AdmitDate as RehabAdmitDate, r.RehabDischDate
FROM ppr.HospDischNoDup H
inner Join ppr.RehabDischNoDup R ON h.memberid=r.memberid
where (r.RehabDischDate - r.AdmitDate)>0 AND (r.AdmitDate - DatePart(H.HospDischDate)) in (0,1) ;
quit;
How can I reconcile it in order to get what I am looking for?
Thank you in advance,
Irin
|