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.
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;
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
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.