06-01-2017 05:17 AM
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.
06-01-2017 05:36 AM - edited 06-01-2017 05:36 AM
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;
06-01-2017 06:04 AM
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?
06-01-2017 06:27 AM
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.