Since you still have not displayed what a resulting data set would look like, I'm only guessing what you want. It appears that you want year-to-date cumulative means at 3,6,and 12 months. But at month 3, you actually want the mean over the 3 PRECEDING months (0, 1, 2). If so, this gets the number, but may or may not be the desired data format:
data want;
set have;
by id;
cumulative_bal+balance;
if first.id then cumulative_bal=balance;
mean3=ifn(month=3,lag(cumulative_bal)/3,.);
mean6=ifn(month=6,lag(cumulative_bal)/6,.);
mean12=ifn(month=12,lag(cumulative_bal)/12,.);
if month in (3,6,12);
run;
... View more