Thank you all so much for the help. I was able to get it working with this bit of code from Reeza found on a previous thread: Data Test_ER_2; set avoid1; by memid admitdt; retain continuous_group 1; prev_date=lag(admitdt); if first.memid then do; prev_date=.; continuous_group=1; end; format prev_date date9.; diff=intck('day',prev_date,admitdt); if intck('day', prev_date, admitdt)>1 then continuous_group + 1; run; Assigned a continuous_group number for each span for each memberID. Was then able to aggregate using member ID and continuous_group. I am going to try it with the code provided above as well. Thank you everyone again for the help
... View more