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
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?
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
Didn't you ask this question a while back?
Hi Reeza, the other question has different assumptions.
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?
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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.