BookmarkSubscribeRSS Feed
warboled
Calcite | Level 5

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.

3 REPLIES 3
Patrick
Opal | Level 21

@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;
Kurt_Bremser
Super User

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.

Kurt_Bremser
Super User

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1891 views
  • 0 likes
  • 3 in conversation