BookmarkSubscribeRSS Feed
Imek
Calcite | Level 5

Hello, 
 
I am trying to determine whether each patient has a gap btw the two prescriptions (drug A and B) and  episode is same within each patient ID.

/*PDC for drug a*/
data pd1;
set drugA_datedays;
array daydummy(1460) day1-day1460;/*set up an array that has 1460 variables: day1 to day 1460 ie 4 years*/
array dd(*) dispdate1 - dispdate220; /* The highest number of Rxs and set up an array for the dispense date*/
array ss(*) days_supply1-days_supply220; /* same for days supply*/
do ii=1 to 1460; daydummy(ii)=0;end;
do ii=1 to 1460;/*Loop will go from 1-365. Outer loop process inner loop 365 times*/
do i = 1 to dim(dd) while (dd(i) ne .);
/*for each person, loop through their total number of Rxs.
Will continue to count as long as there is not a ‘.’ For dd (dispdate); dim returns how many are in the array*/
if dd(i)<= start_dt + ii -1 <= dd(i)+ss(i)-1
then daydummy(ii)=1;
end;
end;
drop i ii;
dayscovered=sum(of day1 - day1460);
label dayscovered='Total Days Covered';
p_dayscovered=(dayscovered/1460)*100;
label p_dayscovered='Proportion of Days Covered';
run;

2 REPLIES 2
PGStats
Opal | Level 21

Your question is missing some text after "If gap btw the two prescription is less than 6 days, "

 

please edit

 

Are you looking for overlaps between drug A and drug B or within the same drug?

PG
Imek
Calcite | Level 5

Thank you for catching my error:) I am looking for overlaps between drug A and B.

 

Thank you

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand in the Innovate Hub.

Watch Now →

Health and Life Sciences Learning

 

Need courses to help you with SAS Life Sciences Analytics Framework, SAS Health Cohort Builder, or other topics? Check out the Health and Life Sciences learning path for all of the offerings.

LEARN MORE

Discussion stats
  • 2 replies
  • 1892 views
  • 0 likes
  • 2 in conversation