This is not too elegant but it solves your stated problem, i think. Depending on the actual data you would need to add another loop for months or BY group processing if the data has one obs per month.
%let week_c = 3;
%let week_t = 6;
%let bweek_c=2;
%let bweek_t=12;
%let mon_c=2;
%let mon_t=26;
%let daily_c=50;
%let buffer=1000;
data want;
month = &mon_t+&mon_c;
frombuffer=&buffer;
do week = 1 to 4;
do day = 1 to 5;
if day=1 then weekly=&week_t;
else weekly = max(0,weekly-&week_c);
if day=1 and mod(week,2)=1 then biweek=&bweek_t;
else biweek = max(0,biweek-&bweek_c);
month = max(0,month-&mon_c);
total=sum(weekly,biweek,month);
remaining=&daily_c-total;
FromBuffer=Frombuffer-remaining;
output want;
end;
end;
run;
proc print data=want;
var week day weekly biweek month total remaining frombuffer;
run;
... View more