BookmarkSubscribeRSS Feed
Gen2514
Calcite | Level 5

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!

12 REPLIES 12
Quentin
Super User

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/ .

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
Gen2514
Calcite | Level 5

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!

Quentin
Super User

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.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
Gen2514
Calcite | Level 5

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" 

Gen2514
Calcite | Level 5

Here is my SAS information

Untitled.png

Kurt_Bremser
Super User

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.

Gen2514
Calcite | Level 5

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!

Kurt_Bremser
Super User

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.

Gen2514
Calcite | Level 5

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.

shayne
SAS Employee

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. 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 12 replies
  • 2375 views
  • 1 like
  • 4 in conversation