Please post your data as text, not as an image. To work with it, we'd have to type it out or convert it to text which is an extra step in trying to help you.
Preferably a data step, but text at minimum.
I think you only want the results when flag=1? If so, delete the results on 0.
Otherwise, please clarify your expected output.
data want;
set have;
by date;
diff_flag = dif(Diff);
if flag_servisizio=0 then call missing(diff_flag);
run;