Sounds like you want something like:
proc sql;
create table current_month as
select date,a,b,c
from have
where date between intnx('month',today(),0,'b') and today()
;
create table prior_month as
select date,a,b,c
from have
where date between intnx('month',today(),-1,'b') and intnx('month',today(),-1,'e')
;
create table prior_month_to_date as
select date,a,b,c
from have
where date between intnx('month',today(),-1,'b') and intnx('month',today(),-1,'s')
;
create table prior_year as
select date,a,b,c
from have
where date between intnx('month',today(),-12,'b') and intnx('month',today(),-1,'s')
;
quit;
Of course, can't test it without data, but I'd think that you could take it from here.
Art, CEO, AnalystFinder.com
... View more