Thank you, was trying to reduce the back and forth details on my task. So, after spending a good chunk of today trying different tweaks, I am simply struggling getting the dates to increment by a month. The current problem that I have is getting the dates to increment by a month after the last end statement (highlighted in red font). I tried adding the MDY function with SUBSRT or SUBSTRN, but that does not seem to work resulting in a missing value when trying to increment THISMONTH1 and THISMONTH2 by a month. Sincerely appreciate the help. ********************************************************************************************************************************************* %LET EOP=202309; %MACRO INCREMENT_MONTHS(INCRMT1_LAG6=,END_MONTH=,INCRMT2_TZERO=); %LET THISMONTH1=%SYSEVALF(&INCRMT1_LAG6); /* LAG 6 */ %LET THISMONTH2=%SYSEVALF(&INCRMT2_TZERO); /* TIME ZERO */ %LET THISMONTH3=%SYSEVALF(&END_MONTH); /* LAST MONTH OF PERFORMANCE WINDOW */ %DO %WHILE(&THISMONTH2 <= %SYSEVALF(&THISMONTH3)); /* DO LOOP IS TIME ZERO TO END OF PERFORMANCE */ %PUT %SYSFUNC(PUTN(&THISMONTH1,YYMMN6.)); %PUT %SYSFUNC(PUTN(&THISMONTH2,YYMMN6.)); %PUT %SYSFUNC(PUTN(&THISMONTH3,YYMMN6.)); /* SOME MACRO CODE GOES HERE USING &THISMONTH WHICH IS A VALID SAS DATE VALUE */ %PULLIT(BY=,WHERE=,CLASS=&SPLITTER,TIMEZERO=&THISMONTH2,START_MONTH=&THISMONTH1,STOP_MONTH=&EOP); %LET THISMONTH1=%SYSFUNC(INTNX(MONTH,MDY(SUBSTR(&THISMONTH1,5,2), 1,SUBSTR(&THISMONTH1,1,4)),1),YYMMN6.); /* INCREMENT MONTH BY 1 */ %LET THISMONTH2=%SYSFUNC(INTNX(MONTH,MDY(SUBSTR(&THISMONTH2,5,2), 1,SUBSTR(&THISMONTH2,1,4)),1),YYMMN6.); /* INCREMENT MONTH BY 1 */ %END; %MEND; %INCREMENT_MONTHS(INCRMT1_LAG6=202109,END_MONTH=202205,INCRMT2_TZERO=202204);
... View more