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!
If you're using SAS Studio, you're still Base SAS user. : 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/ .
Yes, you're right, a former PC SAS 🙂 With PC SAS, I would have used .BAT files.
Thanks for your solution, I will have a look at it!
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.
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"
Which operating system is your SAS server running on?
Here is my SAS information
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.
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).
Thank you for your help & patience!
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.
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.
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?
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.