you shouldn't need infinite looping, set a shared variable and just add to it. something like:
shared numbervar conseq;
if datediff("d", {}, next{}) = 1 then
conseq := conseq +1
else
conseq :=0
and when the group changes, set conseq:=0. Now this is assuming that as soon as the gap is bigger than 1, you would want to add a check for the weekend, that the number of consecutive days would be reset. I don't know what is wanted, but you could increment a counter at the same time to record the number of absences...since that is different from the number of days missed.
HTH