BookmarkSubscribeRSS Feed
raveena
Obsidian | Level 7

Hi All,

For each member number we need to look at the discharge date should be less than 30 days of the next admit date, if so Y else N on the Readmission variable. Please let me know how to apply date logic for this.

Member_Number      Claim_ID         Admit_Date     Discharge_Date Readmission

420000000694600   0102241579644   2/15/2015       2/19/2015

420000000694600   0102121583902   2/2/2015         2/6/2015

420000000694600   0101161597102   1/6/2015          1/8/2015

420000009817200   0106101514987   5/26/2015       5/28/2015

420000009817200   0105051585970   4/18/2015       4/24/2015

420000009817200   0104151510931   4/1/2015           4/3/2015

420000009817200   0103241584788   3/10/2015       3/14/2015

Thanks for your help.

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

Something like this, assuming dates are date format, and data is sorted.

data want;

     set have;

     if lag(member_number)=member_number and admit_date - 30 <= lag(discharge_date) <= admit_date then result="Y";

     else if lag(member_number)=member_number then  result="N";

run;

raveena
Obsidian | Level 7

Hi, Thanks for your reply. It doesn't the satisfy the required condition. Your output looks like as below,

MEMBER                      CLAIM           ADMIT            DISCHARGE         result

420000000694600 0102241579646 7/10/2015        7/12/2015

420000000694600 0102241579645 6/15/2015        6/19/2015                    N

420000000694600 0102241579644 2/15/2015       2/19/2015                      N

420000000694600 0102121583902 2/2/2015         2/6/2015                        N

420000000694600 0101161597102 1/6/2015          1/8/2015                       N

420000009817200 0106101514987 5/26/2015        5/28/2015

420000009817200 0105051585970 4/18/2015       4/24/2015                       N

420000009817200 0104151510931 4/1/2015          4/3/2015                        N

420000009817200 0103241584788 3/10/2015        3/14/2015                          N

Haikuo
Onyx | Level 15

's solution is based on a presumption that your data is sorted first by member , then by admit. do this first, then run his code:

proc sort data=have want=sort_have;

by member admit;

run;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 3 replies
  • 845 views
  • 3 likes
  • 3 in conversation