%macro rrr(start,end);
/* start and end are supplied in YYMM format */
/* feed input data via parameters, not by "something which exists somewhere";
always include a comment describing the parameters */
%local month yymm;
/* prevent unwanted side effects if the variables exist in an outside context;
has to be part of any proper macro code */
%let month = %sysfunc(inputn(&start.,yymmn4.));
%do %while (&month. le %sysfunc(inputn(&end.,yymmn4.)));
%let yymm = %sysfunc(putn(&month.,yymmn4.));
/* your loop code comes here, using yymm */
%let month = %sysfunc(intnx(month;&month.,1,b));
%end;
%mend rrr;
... View more