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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

New Learning Events in April

 

Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.

LEARN MORE

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