BookmarkSubscribeRSS Feed
mrafael03
Obsidian | Level 7

Hello,

I'll start by providing the requirement:

  • Blue highlighted dates are the expected results
  • DAYS_DIFF = 1st DISCH_DT - NEXT ADMIT_DT

 

 

1 REPLY 1
mrafael03
Obsidian | Level 7

CONTINUATION...

 

1. If the discharge is followed by readmission or direct transfer to an acute inpatient care setting within 30-day follow-up period, count only the last discharge.

e.g.

ID     ADMIT_DT   DISCH_DT   DAYS_DIFF

011    1/10/2018       1/13/2018         16      <<< "readmission within 30 days - only include last discharge"

011    1/29/2018       2/28/2018

022    2/13/2018        2/17/2018        55      <<< "readmission >30 days"
022    4/13/2018        4/25/2018

2. For member with same admission date, but different discharge dates; use the last discharge date.

e.g.

ID    ADMIT_DT   DISCH_DT 

033   5/11/2018     5/12/2018
033   5/11/2018     5/17/2018   

3. For member with same discharge date, but different admit date; use the first admit date.

e.g.

ID    ADMIT_DT   DISCH_DT 

033  6/11/2018     6/17/2018
033  6/13/2018     6/17/2018

4. For member with the same 1st discharge date and next admit date, count the 1st admit date and next discharge date.

e.g.

ID     ADMIT_DT   DISCH_DT  DAYS_DIFF

033  08/11/2018    08/17/2018        0
033  08/17/2018     08/23/2018

 

I would like to loop through the dataset by using RETAIN STATEMENT. See the attachment for my SAS codes. I'm still a newbie in SAS and trying to figure out on how to retain/remove rows  based on the criteria. Any help would be greatly appreciated. Thank you!

 

 

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 579 views
  • 0 likes
  • 1 in conversation