BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

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

  1. A.*,
  2. B.ADMIT_DT FORMAT=DATE8.,

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.,*/

  1. B.STAT_DAY

FROM ReAdm.Claims A

LEFT JOIN ReAdm.Claims_Inpt B

ON A.MBR_SYS_ID = B.MBR_SYS_ID

AND

  1. A.FST_SRVC_DT BETWEEN B.ADMIT_DT AND B.DISCH_DT)

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

  1. A.*,
  2. A.ADMIT_DT FORMAT=DATE8.,
  3. B.READMIT_DT FORMAT=DATE8.,
  4. B.REDISCH_DT FORMAT=DATE8.,
  5. B.CUTPUT_DT2 FORMAT=DATE8.

FROM ReAdm.Claims_Merge A

LEFT JOIN ReAdm.Claims_Inpt2 B

ON A.MBR_SYS_ID = B.MBR_SYS_ID

AND

  1. B.READMIT_DT BETWEEN A.DISCH_DT AND A.CUTPUT_DT)

ORDER BY MBR_SYS_ID, STAT_DAY DESC;

QUIT;

PROC SORT NODUPKEY; BY MBR_SYS_ID--PROV_EFF_DT;

RUN;

1 ACCEPTED SOLUTION

Accepted Solutions
2 REPLIES 2
tmm
Fluorite | Level 6 tmm
Fluorite | Level 6


Hum. think everyone is stumped by this one.

tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

got it working

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1820 views
  • 0 likes
  • 1 in conversation