12-28-2017 12:07 PM
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!
12-28-2017 12:44 PM
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/ .
12-28-2017 12:47 PM
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!
12-28-2017 01:26 PM - edited 12-28-2017 01:27 PM
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.
12-28-2017 10:12 PM
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"
12-29-2017 02:13 AM
12-29-2017 08:18 AM
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.
12-29-2017 11:02 AM
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!
12-29-2017 12:21 PM
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.
12-29-2017 01:05 PM
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.
12-29-2017 03:21 PM
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?
01-10-2018 04:11 PM
Here are instructions to enable XCMD on SAS Studio Basic if your IT will allow it:
Essentially the admin of the instance will need to recreate the spawner service with the -allowxcmd option.