Astounding's array() direction is the way to go if you don't have SAS/ETS (proc expand). The array() solution can be further simplified by using temporary array: data want; array tw(0:11) _temporary_; set have; by group; if first.group then call missing(i); i+1; tw(mod(i,12))=cost; if i>=12 then cost_12m=sum(of tw(*)); drop i; run; Regards, Haikuo
... View more