Hi. My data comprises doctor names and the consultation date. The start date for consultations is different across doctors and there are missing days in between. I want the number of consults per week for each doctor from their individual start date. That is, if doctor A started consults on Oct 1, then week 1 = Oct 1-7, week 2 = Oct 8-14; if doctor B started consults on Oct 20, then for them week 1 = Oct 20-26, week 2 = Oct 28-Nov 2. Thus, a week would comprise 7 consecutive days from each doctors individual start date (not necessarily a week starting Monday) irrespective of whether there are missing days in between.
I know how to count weeks from fixed start date, but am having trouble figuring out how to count weeks when the start date varies across doctors. Any help here would be much appreciated. Thanks.
I know how to count weeks from fixed start date, but am having trouble figuring out how to count weeks when the start date varies across doctors. Any help here would be much appreciated. Thanks.
Code:
input str37 ConsultantName float date_n "A" 22952 "A" 22952 "A" 22952 "A" 22959 "A" 23001 "A" 23001 "A" 23001 "A" 23001 "A" 23044 "A" 23059 "B" 22922 "B" 22922 "B" 22929 "B" 22929 "B" 22936 "B" 22943 "B" 22950 "B" 22957 "B" 22957
Comment