03-25-2013 02:30 PM
The following macro uses this month as a start date and goes back based on the number of months chosen to produce separate 30 day spreadsheets. I want one report that combines February and March 2013 into one report (60 Day Analysis) Go back 2 months instead of one month.
%MACRO FPD_IT (n=);
FirstDay=intnx('Month', TODAY(), &n, 'beginning');
CALL SYMPUT('StartDate', FirstDay);
CALL SYMPUT('StartDateMMMYY', PUT( FirstDay,EURDFMY5.));
CALL SYMPUT('StartDateMonth', PUT( FirstDay,EURDFMN3.));
CALL SYMPUT('StartDateYear', PUT( FirstDay,YEAR2.));
WHERE LN_NXT_PMT_DUE_DT EQ &StartDate.
AND LN_FST_DUE_DT EQ &StartDate.
%FPD_IT (n=-1); /*pulls last month or February 2013 based on last month */
%FPD_IT (n=0); /*pulls March 2013, based on this month*/
03-25-2013 02:47 PM
We cannot see the end of your macro to see how you are making the report itself. Most likely you want to create the WHERE in the DATA step so that it has all the appropriate dates. You can also eliminate your DATA _NULL_ step.
%let lastddate = %sysfunc(intnx(Month, %sysfunc(TODAY()), &n));
%let startdate = %sysfunc(intnx(Month, %sysfunc(TODAY()), %eval(&n-1)));
the WHERE becomes something like:
where &startdate le date le &lastdate;
But until we know more of what you need these are guesses.