I stand corrected. I've edited my above example although I recommend not using it. It is a not so trivial way around "pile" effect of lag function. It works though! Thanks Vince Here's the approach I would probably use similar to others above although saving the conditional if statement in favor of the coalesce function. data want; set have; total=value+coalesce(total,0); retain total; run;
... View more