BookmarkSubscribeRSS Feed
NewSASPerson
Quartz | Level 8

Hi there experts,

 

I am trying to determine concurrent days between 2 groups of drugs but I want it counted only once but what I have now is counting within each fill. Patient ID , 114 is correct and the others are double counting. I would appreciate any insight on how to approach this. Thank you for you help.

 

patient id Group1_Drug Group1_Start_date Group1_end_date Group2_Drug Group2_Drug_StartDate Group2_Drug_EndDate concurrent_days
114 Drug C 4/6/2022 5/6/2022 Drug T 5/4/2022 5/11/2022 3
114 Drug C 6/10/2022 7/10/2022 Drug AC 7/2/2022 7/3/2022 2
114 Drug C 6/10/2022 7/10/2022 Drug AC 7/5/2022 7/10/2022 6
114 Drug C 7/11/2022 8/10/2022 Drug AC 7/20/2022 7/22/2022 3
114 Drug C 8/9/2022 9/8/2022 Drug AC 8/23/2022 8/26/2022 4
114 Drug C 9/7/2022 10/7/2022 Drug HC 9/17/2022 9/19/2022 3
114 Drug C 12/1/2022 12/31/2022 Drug AC 12/12/2022 12/15/2022 4
114 Drug C 12/1/2022 12/31/2022 Drug AC 12/29/2022 1/1/2023 3
152 Drug L 1/11/2022 2/10/2022 Drug AC 1/18/2022 1/20/2022 3
152 Drug D 2/24/2022 3/26/2022 Drug T 3/11/2022 3/17/2022 7
152 Drug L 3/10/2022 4/9/2022 Drug T 3/11/2022 3/17/2022 7
152 Drug D 7/18/2022 8/17/2022 Drug ACP 7/25/2022 8/1/2022 8
152 Drug L 7/21/2022 8/20/2022 Drug ACP 7/25/2022 8/1/2022 8
152 Drug L 10/18/2022 11/17/2022 Drug ACP 11/16/2022 11/21/2022 2
152 Drug D 10/26/2022 11/25/2022 Drug ACP 11/16/2022 11/21/2022 6
152 Drug L 11/17/2022 12/17/2022 Drug ACP 11/16/2022 11/21/2022 5
152 Drug L 11/17/2022 12/17/2022 Drug ACP 12/8/2022 12/13/2022 6
152 Drug D 11/27/2022 12/27/2022 Drug ACP 12/8/2022 12/13/2022 6
158 Drug A 1/11/2022 2/10/2022 Drug T 1/11/2022 2/3/2022 24
158 Drug A 1/11/2022 2/10/2022 Drug T 2/8/2022 3/3/2022 3
158 Drug A 2/8/2022 3/10/2022 Drug T 2/8/2022 3/3/2022 24
919 Drug A 5/19/2022 6/18/2022 Drug AC 5/26/2022 6/5/2022 11
919 Drug A 5/19/2022 6/18/2022 Drug AC 6/11/2022 6/14/2022 4
919 Drug A 8/12/2022 9/11/2022 Drug AC 9/7/2022 9/17/2022 5
919 Drug A 9/8/2022 10/8/2022 Drug AC 9/7/2022 9/17/2022 10
919 Drug A 9/8/2022 10/8/2022 Drug AC 10/3/2022 10/23/2022 6
919 Drug A 10/7/2022 11/6/2022 Drug AC 10/3/2022 10/23/2022 17
919 Drug A 10/7/2022 11/6/2022 Drug AC 11/1/2022 11/21/2022 6
919 Drug A 11/3/2022 12/3/2022 Drug AC 11/1/2022 11/21/2022 19
919 Drug A 12/1/2022 12/31/2022 Drug AC 12/8/2022 12/28/2022 21
919 Drug A 12/1/2022 12/31/2022 Drug AC 12/28/2022 1/17/2023 4
919 Drug A 12/28/2022 1/27/2023 Drug AC 12/8/2022 12/28/2022 1
919 Drug A 12/28/2022 1/27/2023 Drug AC 12/28/2022 1/17/2023 21
1 REPLY 1
NewSASPerson
Quartz | Level 8

The original table is what i have and below is what I am looking for. I would appreciate some insight how to approach this

Patient ID Group1_Start_date Group1_end_date   Group2_Drug_StartDate Group2_Drug_EndDate   concurrent days
114 4/6/2022 5/6/2022   5/4/2022 5/11/2022   3
114 6/10/2022 7/10/2022   7/2/2022 7/3/2022   2
114 6/10/2022 7/10/2022   7/5/2022 7/10/2022   6
114 7/11/2022 8/10/2022   7/20/2022 7/22/2022   3
114 8/9/2022 9/8/2022   8/23/2022 8/26/2022   4
114 9/7/2022 10/7/2022   9/17/2022 9/19/2022   3
114 12/1/2022 12/31/2022   12/12/2022 12/15/2022   4
114 12/1/2022 12/31/2022   12/29/2022 1/1/2023   3
152 1/11/2022 3/10/2022   1/11/2022 2/3/2022   24
152 1/11/2022 3/10/2022   2/8/2022 3/3/2022   24
158 2/24/2022 4/9/2022   3/11/2022 3/17/2022   7
158 7/18/2022 8/20/2022   7/25/2022 8/1/2022   8
158 10/18/2022 12/27/2023   11/16/2022 11/21/2022   6
158 10/18/2022 12/27/2023   12/8/2022 12/13/2022   6
919 5/19/2022 6/18/2022   5/26/2022 6/5/2022   11
919 5/19/2022 6/18/2022   6/11/2022 6/14/2022   4
919 8/18/2022 1/27/2023   9/7/2022 9/17/2022   11
919 8/18/2022 1/27/2023   10/3/2022 10/23/2022   21
919 8/18/2022 1/27/2023   11/1/2022 11/21/2022   21
919 8/18/2022 1/27/2023   12/8/2022 1/17/2023   41
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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