05-23-2014 02:48 PM
I have 8 macros to run in sequence. It is imperative that one completes before the other starts.
The macros would be run on 10 datasets with names that increase by 1.
How can I do this in a %Macro do loop while ensuring that one macro completes before the other starts?
Thanks in advance.
05-23-2014 03:50 PM
How are you calling them currently?
I believe the default behaviour is to wait for one process to finish before starting others, so unless you change something that's what will happen.
05-23-2014 06:04 PM
Statements entered in SAS are executed sequentially, so you shouldn't have any real concerns about the process flow (of course there are exceptions, but I would not believe any of them apply here at a novice level).
*list the macro's sequentially;
*call macro's from a macro with same name plus numerical suffix;
%do i = 1 %to 10;
%let lmacname = mymacro&i;
*call list of macro's when names are different;
%let maclist=mymac1 secondone lastone;
%do i = 1 %to %sysfunc(countw(&maclist));
*call list of macro's from a datastep;
input macname $;
There are plenty of other ways to do it as well, but the exact problem is not completely apparent from your question.