Ok. So I have the below code that merges 2 tables. 1 has the claims information for the patients from the other table. Patients can have multiple admission dates for the same procedure. So, the goal is to say after the patient was discharged say on 1/1/2011 was there a readmission on 1/2/2011 + 30days. The readmission with my code is looking at if they were readmitted the same day and the disch_dt still +30 days. But I need to look and say start looking the day after they were discharged. I tried b.disch_dt+1 for the first case statement but that returned over 7k readmissions which is not correct. It should be around 3800. So I have a comment in there but did that and that did not work. Left the comments in there, not sure why. Maybe so others can see what I have attempted. Not sure what that A. B. things are. that is not in the code. Those Cap letters like the one prior to A.*,. I pasted this from my code so it looks like something that was added on paste. This code runs just fine just does not output the expected results. Again I need it to look at if the patient was discharged on whatever date. Does not matter. Just used 1/1/2011 as example. But say they were discharged 6/30/2011. I need to give it 1 full day, so beging looking on 7/1/2011 and if they were readmitted between 7/1/2011 and 30 days then yes they were readmitted. Thanks. Hope someone can help me figure this out. I know it has something to do with adding an additional case and then the next code that is data needs something added to it.
PROC SQL;
CREATE TABLE ReAdm.Claims_Merge AS
(SELECT DISTINCT
CASE WHEN B.DISCH_DT IS NULL THEN A.FST_SRVC_DT ELSE B.DISCH_DT END AS DISCH_DT FORMAT=DATE8.,
CASE WHEN B.DISCH_DT IS NOT NULL THEN B.DISCH_DT+30 END AS CUTPUT_DT FORMAT=DATE8.,
/*CASE WHEN B.ADMIT_DT IS NOT NULL THEN B.DISCH_DT+1 END AS START_DT FORMAT=DATE8.,*/
FROM ReAdm.Claims A
LEFT JOIN ReAdm.Claims_Inpt B
ON A.MBR_SYS_ID = B.MBR_SYS_ID
AND
ORDER BY MBR_SYS_ID, STAT_DAY DESC;
QUIT;
PROC SORT NODUPKEY; BY MBR_SYS_ID--PROV_EFF_DT;
RUN;
DATA READM.CLAIMS_INPT2; SET READM.CLAIMS_INPT;
READMIT_DT=ADMIT_DT;
REDISCH_DT=DISCH_DT;
CUTPUT_DT2=DISCH_DT+30;
FORMAT READMIT_DT DATE8. REDISCH_DT DATE8. /*COUNT_DT DATE8.*/ CUTPUT_DT2 DATE8.;
KEEP READMIT_DT REDISCH_DT MBR_SYS_ID COUNT_DT CUTPUT_DT2 ;
RUN;
PROC SQL;
CREATE TABLE ReAdm.Claims_Merge2 AS
(SELECT DISTINCT
FROM ReAdm.Claims_Merge A
LEFT JOIN ReAdm.Claims_Inpt2 B
ON A.MBR_SYS_ID = B.MBR_SYS_ID
AND
ORDER BY MBR_SYS_ID, STAT_DAY DESC;
QUIT;
PROC SORT NODUPKEY; BY MBR_SYS_ID--PROV_EFF_DT;
RUN;
got it working
Hum. think everyone is stumped by this one.
got it working
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.