I have several separate SAS codes inside a process flow. Now I want to add loops (by year and lookback) on top of the SAS codes starting from ”2-extract input files” (see the figure attached) to the end. Of course I can put all the codes together and add a Macro like:
%MACRO mFilter(nYr_, lookback_);
Read in macro variables and put all needed codes here
%MEND;
* run multiple years;
%MACRO mMain(nYr1_, nYr2_, lookback_);
%DO y = &nYr1_ %TO &nYr2_;
%DO x = 1 %TO &lookback_;
%mFilter(&y, &x)
%END;
%MEND;
%mMain(&mYear1, &mYear2, &mLookback); * values given;
My question is: Can SAS EG do the loops easily by adding prompts or other ways to the programs or to the process flow while keeping the SAS code programs separate so that it is easy to check logs, and if yes, can you provide details ?
Thanks a lot.