03-06-2018 06:58 AM
03-06-2018 07:43 AM - edited 03-06-2018 07:47 AM
the rules you follow are not clear to me:
"If on Jan 15th, the same member gets another prescription for a 10 days, the value would still be 30 days. But if another member gets one prescription on Jan 1st for 30 days and another prescription on Jan 25th for 10 days the days streak would now be at 35 days"
With the rows 30 and 10 you create one time a row of 30 and the other time a row of 35, what's the trigger? is it a date other than the 15th of the month? and what is the rule, is it 30+10/2?
"If there was a gap of more than 2 days between prescriptions a new set of days would be created based on above algorithm."
Please clarify and provide an example
- Cheers -
03-06-2018 07:54 AM
Assuming I understood what you mean.
data have; input MemberId Fill_date : mmddyy12. Days_supply_cnt; format fill_date mmddyy10.; cards; 12345 01/01/2017 30 12345 01/15/2017 10 12345 02/10/2017 60 23456 01/01/2017 30 23456 01/25/2017 10 23456 04/01/2017 90 ; run; data temp; set have; do date=fill_date to fill_date+Days_supply_cnt-1; output; end; keep memberid date; format date mmddyy10.; run; proc sort data=temp out=temp1 nodupkey; by memberid date; run; data temp2; set temp1; by memberid; if first.memberid or dif(date) ne 1 then group+1; run; proc freq data=temp2 noprint; table memberid*group/out=want list; run;
03-06-2018 03:20 PM
Need further help from the community? Please ask a new question.