I could not get this code to count abstinence intervals. It just counts weekly or daily intervals (whichever I denote as my day variable). Here is my code: I have renamed (weekstartdate to date and created a daily variable). data want2 (drop=date day); do until (last.abs_yes); set counting_dates; retain day 1; by id date abs_yes notsorted; if first.abs_yes then do; beg_date= date + day-1; end; end; end_date=date+day-1; format beg_date end_date mmddyy10.; run; proc print data=want2 (obs =100); RUN; Can you help? I'm just not sure what I'm doing wrong. It runs, I'm just not getting the same output.
... View more