DATA Step, Macro, Functions and more

days overlap

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 128
Accepted Solution

days overlap

[ Edited ]
Patient_id  Medication_name Dispensing_Date  days_supply
1  a             1/1/2003   30
1  a             4/4/2004   60
1  b             3/4/2004   90
2  a             1/1/2003  30
2  a             4/4/2004   60
2  b             3/4/2004   90
2  c             3/15/2004  90
2  a             1/1/2002   60
2  d             1/1/2002   60
3 a              1/1/2005   30
3 b              2/2/2010    30
4  b             2/3/2009    60
4 g              4/4/2005    60
4  c             1/1/2006    60
4 e               1/1/2006   60
4  a              1/1/2004   90
4  b              1/28/2004  60
4  t               1/28/2004  60
4 o               1/15/2004  90

Accepted Solutions
Solution
‎07-15-2016 07:19 PM
Super User
Posts: 19,850

Re: 60 days overlap

Posted in reply to lillymaginta

As far as I can see the only difference is 60 versus 30 days and you should be able to adjust the code for that. Have you tried replacing 30 with 60? 

https://communities.sas.com/t5/Base-SAS-Programming/frequency-of-multiple-observations-hapenning-at-...

 

I'm also assuming mono means single usage not the disease? 

 

 

Regarding the last 4 qs use either a double proc freq or proc SQl with count distinct. 

 

Proc freq data=have;

table id*drug/out = drugs_per_id;

run;

 

proc freq data=drugs_per_id;

table id/ out=distinct_coumt;

run;

 

You can then transpose this table to generate your output. 

 

Though it does appear this one was answered as well here :

https://communities.sas.com/t5/SAS-Procedures/assessing-dual-drug-use/m-p/265554#M57898

View solution in original post


All Replies
Super User
Posts: 19,850

Re: 60 days overlap

Posted in reply to lillymaginta

Didn't you ask this question a while back?

Frequent Contributor
Posts: 128

Re: 60 days overlap

Hi Reeza, the other question has different assumptions. 

Solution
‎07-15-2016 07:19 PM
Super User
Posts: 19,850

Re: 60 days overlap

Posted in reply to lillymaginta

As far as I can see the only difference is 60 versus 30 days and you should be able to adjust the code for that. Have you tried replacing 30 with 60? 

https://communities.sas.com/t5/Base-SAS-Programming/frequency-of-multiple-observations-hapenning-at-...

 

I'm also assuming mono means single usage not the disease? 

 

 

Regarding the last 4 qs use either a double proc freq or proc SQl with count distinct. 

 

Proc freq data=have;

table id*drug/out = drugs_per_id;

run;

 

proc freq data=drugs_per_id;

table id/ out=distinct_coumt;

run;

 

You can then transpose this table to generate your output. 

 

Though it does appear this one was answered as well here :

https://communities.sas.com/t5/SAS-Procedures/assessing-dual-drug-use/m-p/265554#M57898

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 350 views
  • 1 like
  • 2 in conversation