Sivakoya, The below would certainely need to be optimized. But this shoud do the purpose. Good Luck. data test ;
input month_end date7. acct_nbr x ;
datalines ;
30sep16 1 100
31oct16 1 50
30nov16 1 25
30dec16 1 10
31oct16 2 50
30nov16 2 0
;
run ;
data test2;
set test ;
by acct_nbr ;
Y=last.acct_nbr ;
format month_end date10. ;
run ;
proc sql;
create table test3 as
select *
from test2
where Y=1 ;
quit ;
proc sql;
create table test4 as
select intnx('month',month_end,1,'end') as month_end format=date10.,acct_nbr,x
from test3
where month(month_end) <> month(intnx('month',today(),-1,'end')) ;
quit ;
data test5 ;
set test4 test ;
run ;
proc sql ;
select month_end format=date10.,acct_nbr,x
from test5
order by 2,1;quit ;
... View more