## Calculate Readmission if one is present help

Solved
Regular Contributor
Posts: 238

# Calculate Readmission if one is present help

PROC SQL;

(SELECT DISTINCT

1. A.*,

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

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;

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;

(SELECT DISTINCT

1. A.*,
4. B.REDISCH_DT FORMAT=DATE8.,
5. B.CUTPUT_DT2 FORMAT=DATE8.

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;

Accepted Solutions
Solution
‎04-12-2012 09:03 AM
Regular Contributor
Posts: 238

## Re: Calculate Readmission if one is present help

got it working

All Replies
Regular Contributor
Posts: 238

## Re: Calculate Readmission if one is present help

Hum. think everyone is stumped by this one.

Solution
‎04-12-2012 09:03 AM
Regular Contributor
Posts: 238

## Re: Calculate Readmission if one is present help

got it working

🔒 This topic is solved and locked.