Thanks @novinosrin 's dataset .
data have;
input TxnID Month : yymmn6. Value;
format Month yymmn6.;
cards;
1 201811 120
1 201812 240
1 201902 350
1 201903 400
1 201905 100
2 201812 200
2 201902 300
;
data want;
merge have have(keep=txnid month rename=(txnid=_id month=_month) firstobs=2);
output;
if txnid=_id then do;
do i=1 to intck('month',month,_month)-1;
month=intnx('month',month,1);output;
end;
end;
drop _: i;
run;
... View more