Write and run SAS programs in your web browser

SAS Studio Batch submit multiple files with individual logs

Reply
Occasional Contributor
Posts: 6

SAS Studio Batch submit multiple files with individual logs

Hello,

I am a former Base SAS user, now using SAS Studio and struggling with the batch submit function. For my work, I need to batch submit multiple files and create individual .lst and .log files. For example, if I need to run 20 files, I need 20 .log and 20 .lst files. Is it possible to do that in SAS Studio 3.6?

 

One solution is to manually batch submit the multiple files but this would take too long for us. 

Another solution is to batch submit a new program which includes the call of the multiple programs. However, this would create only 1 log and 1 .lst and this is not what we are looking for.

 

Thank you for your help!

PROC Star
Posts: 1,362

Re: SAS Studio Batch submit multiple files with individual logs

If you're using SAS Studio, you're still  Base SAS user. :Smiley Happy I assume you mean you are a former PC SAS (i.e. Display Manager) user?  When you were using PC SAS, how would you accomplish this goal?

 

Assuming XCMD is enabled in your SAS session, I would think you could write a SAS program that uses the SYSTASK to start 20 different SAS sessions, each session with it's own log and list file.  See e.g. https://amadeus.co.uk/sas-tips/systask-the-spawn-of-sas-programmers/ .

Occasional Contributor
Posts: 6

Re: SAS Studio Batch submit multiple files with individual logs

Yes, you're right, a former PC SAS Smiley Happy With PC SAS, I would have used .BAT files.

 

Thanks for your solution, I will have a look at it!

PROC Star
Posts: 1,362

Re: SAS Studio Batch submit multiple files with individual logs

[ Edited ]

If your SAS studio client is connecting to a Windows server, then a .BAT file might still be an option. If you're connecting to a Linux server, then there are analogous shell scripting options.

Occasional Contributor
Posts: 6

Re: SAS Studio Batch submit multiple files with individual logs

Hi again!

Could you help me check if the XCMD is enabled on my SAS Studio? I am pretty sure it isn't since it is the default for SAS Studio.

 

I have tried the .BAT and it does not recognize the SAS root. Here is what I ran:

"C:\Program Files\SASFoundation\9.4"  -SYSIN  "C:\Users\Desktop\QC_d0_DM.sas" -log "C:\Users\Desktop\QC_DM.log" 

Super User
Posts: 8,359

Re: SAS Studio Batch submit multiple files with individual logs

Which operating system is your SAS server running on?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 6

Re: SAS Studio Batch submit multiple files with individual logs

Posted in reply to KurtBremser

Here is my SAS information

Untitled.png

Super User
Posts: 8,359

Re: SAS Studio Batch submit multiple files with individual logs

So your SAS runs on Windows, and the .bat approach should work. How did you find out that your SAS call was incorrect?

 

Since you have a client-server setup, I'd prefer to use the sasbatch.sh script in sasroot\Lev1\SASApp\BatchServer. That gives you the same environment you have in SAS Studio.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 6

Re: SAS Studio Batch submit multiple files with individual logs

Posted in reply to KurtBremser

Using this call:

"C:\Program Files\SASHome\SASFoundation\9.4"  -SYSIN  "C:\Users\Desktop\QC_d0_DM.sas" -log "C:\Users\Desktop\QC_DM.log" 

 

The part in red was found with SAS Studio, using the function %sysget(sasroot). However, I don't have the folder SASFoundation. I am not the administrator of SAS (our IT team is).

 

 

Untitled.png

 

Thank you for your help & patience!

Super User
Posts: 8,359

Re: SAS Studio Batch submit multiple files with individual logs

This looks like your local directory on your desktop PC. The server's sasroot will have quite more than just SASFoundation added.

If you have XCMD enabled, you can test your script like that:

filename osmcd pipe '"C:\Program Files\SASHome\SASFoundation\9.4"  -SYSIN  "C:\Users\Desktop\QC_d0_DM.sas" -log "C:\Users\Desktop\QC_DM.log 2>&1';

data _null_;
infile oscmd;
input;
put _infile_;
run;

The SAS log will contain all responses from the operating system.

Mind that you most probably won't have permission to store your code (and log) in C:\Users\Desktop, so you need to use another path when storing/uploading your code to the server.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 6

Re: SAS Studio Batch submit multiple files with individual logs

Posted in reply to KurtBremser

The XCMD is not enabled, so I cannot test it. Could it be the reason why the .bat is not working?

 

I will have to check with IT if it is possible to enable it.

Highlighted
Super User
Posts: 8,359

Re: SAS Studio Batch submit multiple files with individual logs

So you tried to run SAS locally (which can't work, for obvious reasons), or did you log on to the server with a commandline tool?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
SAS Employee
Posts: 17

Re: SAS Studio Batch submit multiple files with individual logs

Here are instructions to enable XCMD on SAS Studio Basic if your IT will allow it: 

SAS Studio Administrator's Guide > SAS Studio Basic > Enabling the X Commands

 

Essentially the admin of the instance will need to recreate the spawner service with the -allowxcmd option. 

Ask a Question
Discussion stats
  • 12 replies
  • 232 views
  • 1 like
  • 4 in conversation