Hello everybody, I'm using sas enterprise guide and i need solve a problem of multiple executions of a flow.
I need execute a flow in meny times, that number is for each month from 2016-01 to now, so i need a method for run it and it continue running repeatedly for every month.
I'm not aware of any method in EG which would allow you to loop over a flow multiple times programmatically.
On a coding level:
You could export all the code in the flow and copy this code into an EG code node, then wrap a macro around it and add a data step where you call the macro as many times as you like.
Below a code sample to illustrate the approach. The code within macro loopy is what you would copy from your current flow. You then would need to edit this code adding macro variable &rundate so you can pass in the month you process as parameter in the data step.
%macro loopy(rundate);
data inter;
format var date9.;
var=&rundate;
run;
proc append base=want data=inter;
run;
%mend;
data _null_;
process_date='01JAN2016'd;
do while(process_date<intnx('month',today(),0,'b'));
call execute('%loopy('||process_date||')');
process_date=intnx('month',process_date,1,'b');
end;
run;
When posting, you were advised to use a descriptive subject line. Please do so in the future.
I edited your question accordingly.
Using just your username as the subject line is, ahem, not a very bright thing to do.
Another solution:
Export all code to a .sas file.
In the program, retrieve necessary values from environment variables with %sysget.
Then create a shell script that runs this program in a "for" loop and supplies the values in environment variables.
This would be precursor work for later handover to a scheduling system.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.