Desktop productivity for business analysts and programmers

Execute process flow multiple times

Reply
New User
Posts: 1

Execute process flow multiple times

[ Edited ]

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.

Respected Advisor
Posts: 4,668

Re: warboled

@warboled

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;
Super User
Posts: 9,880

Re: Execute process flow multiple times

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Super User
Posts: 9,880

Re: Execute process flow multiple times

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Ask a Question
Discussion stats
  • 3 replies
  • 137 views
  • 0 likes
  • 3 in conversation