Running multiple SAS Programs via batch on linux

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Running multiple SAS Programs via batch on linux

Hi SAS Experts,

 

I try to run mutliple SAS programs in a Batch after each other and Re-Use all the results from the previous executed programs.

 

Why: I start with an EGP Project, nicely ordering the code in diffrent programs, and then export everything to *.sas files to get a batch ready enviroment.

 

To run the diffrent programs I created a SAS macro, in the hope it will keep the Session, unfortiantly, it doestn seems to work:

 

run.sas :

%let basepath = /srv/sas/projects/cirun/fwd;
%let projectname = /myprojectfiles/;
run;
%include "&basepath.&projectname.build/00a_init.sas";
run;
%include "&basepath.&projectname.build/01a_load_akq.sas";
run;

 

...and ongoing...

 

Any Ideas?

 

Regards,

Tobi


Accepted Solutions
Solution
‎06-12-2018 01:06 PM
Respected Advisor
Posts: 4,736

Re: Running multiple SAS Programs via batch on linux

Posted in reply to TobiasGrossmann

@TobiasGrossmann

An %include statement allows you to include SAS code kept in another file BUT the code gets run as if all this code would directly "live" in the place where you've got the %include statement. 

For this reason organizing code in multiple files and then bringing it together with %include statements, runs the all the code as one big single programs and for this reason you should have all the tables accessible within the same session.

 

It doesn't matter if you run the master program (with the %includes in it) in batch or in an interactive session. It's still: All the code is together so everything should be available to all the bits as long as the session is active.

View solution in original post


All Replies
Super User
Super User
Posts: 9,599

Re: Running multiple SAS Programs via batch on linux

Posted in reply to TobiasGrossmann

"Batch after each other and Re-Use all the results from the previous executed programs." - If you have several programs that all use the same output, then link them in one overall file, batch submit the overall file, and they can then include all the sub programs - i.e. one session lots of programs being run.  Not much point in starting a new session for each program, as you then need to start up and close SAS each, and store outputs to a physical location for the next part of the process.  So unless there is a really good reason, 1 session, which runs all your code would be better.

Solution
‎06-12-2018 01:06 PM
Respected Advisor
Posts: 4,736

Re: Running multiple SAS Programs via batch on linux

Posted in reply to TobiasGrossmann

@TobiasGrossmann

An %include statement allows you to include SAS code kept in another file BUT the code gets run as if all this code would directly "live" in the place where you've got the %include statement. 

For this reason organizing code in multiple files and then bringing it together with %include statements, runs the all the code as one big single programs and for this reason you should have all the tables accessible within the same session.

 

It doesn't matter if you run the master program (with the %includes in it) in batch or in an interactive session. It's still: All the code is together so everything should be available to all the bits as long as the session is active.

New Contributor
Posts: 2

Re: Running multiple SAS Programs via batch on linux

thanks a lot :-)

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 99 views
  • 1 like
  • 3 in conversation