Desktop productivity for business analysts and programmers

Loop back to node and run branch again

Reply
Occasional Contributor
Posts: 9

Loop back to node and run branch again

Morning all,

 

I have some EG code that starts with a prompt window for the user to select items, then runs through c.10 program nodes, before creating an ODS Excel Output and saving to the network using the Copy Files Add-In.

 

This is all fine for one off runs of the code, but each month we need to run the code around 50 times manually, selecting a different set of prompts for each run before waiting for the output to be saved to the network and repeating again.

 

My question is, how would people go about automating this sort of report?  I could have a input file that holds details of the Prompts for each run and have SAS read that in, and then use those inputs to generate th report, but how would you get SAS to go back to the first node of the program?  How would you bypass the prompt selection coming up?  Does it need to be a standalone program in itself, instead of messing with the more manual version of the code?

 

Just looking for thoughts on the process from anyone who may have had to face into this.

 

Many thanks

Jamie

Super User
Posts: 3,235

Re: Loop back to node and run branch again

[ Edited ]

One way would be to make use of CALL EXECCMD. Create a prompt dataset with one row for each prompt and program run. Define each prompt as a macro variable that is then used in the program being included.

 

data _null_;
  set PromptData;
  call execcmd('%let prompt1 = ' !! prompt1 !! '; %include "MyProgram.sas";');
run;
Occasional Contributor
Posts: 9

Re: Loop back to node and run branch again

Thanks SASKiwi.  I havent seen CALL EXECCMD before but it looks interesting so will look into that. 

 

At the moment, because of our SAS Install, the server cannot see the Network Drives where the sas code is stored, so i'm not sure I could do a %Include to the code.  Also, because it's in Enterprise Guide, how would I tell it which node of the code to start running from?

 

Cheers

Super User
Posts: 3,235

Re: Loop back to node and run branch again

Well I'm assuming you know which part of your EG project needs repeating. You could export that part of your project out of EG to a SAS program and store it in a location accessible by your SAS server.

 

Judging by your requirements, I suggest a coded solution would be better for this type of automation. 

Ask a Question
Discussion stats
  • 3 replies
  • 100 views
  • 0 likes
  • 2 in conversation