Sara
Here is an approach.
Sort by patient ID, script_dt
Set up an array of prescribers (50) for an Id and hold start script date
On first.ID clear the prescriber array, start date
With each obs check the new script_date with the start script date
If < 365 check to see if prescriber in array
If new prescriber add prescriber to array and add 1 to tot_scripts
If tot_scrits gt 4 then set flag
If last.ID the output..
To do a rolling 365 over several years, you might want to create a 2 dimensional array and keep the script dates and prescribers for each patient.
Jim
... View more