BookmarkSubscribeRSS Feed
bzubrick
Obsidian | Level 7

Not sure if this is a SAS question (if it's not just let me know and I can delete the thread), but at my job we have like 7 SAS programs that we submit one by one by right clicking and hitting "Batch Submit" button. I've tried to consolidate the 7 programs into one that can be submitted at once but i think the need to be run individually in order. My question is, is there some way to submit those jobs using some sort of dashboard or console that has buttons or something similar? Maybe like a VBA button in Excel? Management says they don't like having people right clicking and hit submit, so they want a easier, more user friendly way for this to occur. Ideally I would build other functionality into this dashboard eventually but just want to see if anyone has thoughts on batch submitting jobs via some sort of external internface. 

 

Any other articles or links about automating SAS jobs would be awesome. For example, can you submit a job automatically based on a schedule? 

 

Very new to SAS so trying to get a feeling for what is possible and what is not.

9 REPLIES 9
bzubrick
Obsidian | Level 7

We run it on a Remote Desktop Server. Windows Server 2012 R2 Standard, 64 bit. Would LOVE if people could submit stuff outside the server environment, but don't think that's possible so don't mind having people log into the server to "submit" the jobs (aka click the buttons) in the example I describe above.

bzubrick
Obsidian | Level 7

What do you mean by "A link on the desktop"? Would they still have to right click and hit batch submit?

 

Also in terms of consolodating those jobs into one step, do you have any sample code on how something like that could occur. Also does it matter that the steps are dependent on one another? Meaning, if job 1 creates a file that job 2 needs in order to execute successfully, would that be a problem in terms of writing a script that combines them all at once?

Kurt_Bremser
Super User

@bzubrick wrote:

What do you mean by "A link on the desktop"? Would they still have to right click and hit batch submit?

 

Also in terms of consolodating those jobs into one step, do you have any sample code on how something like that could occur. Also does it matter that the steps are dependent on one another? Meaning, if job 1 creates a file that job 2 needs in order to execute successfully, would that be a problem in terms of writing a script that combines them all at once?


A Windows batch file (like a shell script in UNIX) is just a text file that contains commands, just like commands you type into a cmd window.

Consider this:

"C:\Program Files\SASHome\SASFoundation\9.4\sas" -sysin C:\Programs\program1.sas -log C:\Logs\program1.log
"C:\Program Files\SASHome\SASFoundation\9.4\sas" -sysin C:\Programs\program2.sas -log C:\Logs\program2.log
"C:\Program Files\SASHome\SASFoundation\9.4\sas" -sysin C:\Programs\program3.sas -log C:\Logs\program3.log

Save that as (eg) C:\scripts\mysas.bat.

Then (in the Windows explorer) right-click on that mysas.bat, and select "Create Link". Then drag&drop that link onto the Desktop.

 

Once you double-click that link, the programs will be run in succession. In a batch file, you can also add conditions so that later programs will only run if the previous returned successfully. Just google "windows batch conditional execution" to find some hints.

Shmuel
Garnet | Level 18

You need run your programs batch.

You can do it by scheduling scripts to run at any periods.

 

If you need examples of how to write rhe scripts you have to give informatin of your Opereating Sysytem -

is it WINDOWS or LINUX or other and which version.

bzubrick
Obsidian | Level 7
We run it on a Remote Desktop Server. Windows Server 2012 R2 Standard, 64 bit.
Shmuel
Garnet | Level 18

I'm not familiar with writing windows scripts, anyhow you need prepare next parameters:

 

1) server name

2) server path to sas executable file (.exe)

3) sas configuration file, adapted to run batch, its path and name - on server

4) sas autoexec file (with libnames, filenames, etc.)

5) sas log file to save/replace - path and name

5) sas program - path and name - ready to run

 

Does windows scheduler enambles define order of submitting jobs ? 

 

After preparing the scripts enter them in right order and linkage in the scheduler.

 

You may add in the programs checking existence of input files and datasets, if need.

AlanC
Barite | Level 11

Simple answer is yes, I have done it many times both graphically (button on desktop app, as an add-in to SAS EG, as an add-in on Excel) as well as using cmd files. I would recommend not using cmd/bat files. They do work but I would focus on using PowerShell in Windows.

 

For a Windows app (UI), it is a lot easier to do this if you have SAS integration technology. Chris Hemendinger does a lot of blog posts on this area so look for his stuff.If you have SAS EG, Also, consider buying his book. 

 

Personally, I stand it up using C#, mostly using web services but the techniques are the same regardless of whether you use VBA, C#, VB.NET, PowerShell, etc. 

 

https://github.com/savian-net

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 9 replies
  • 987 views
  • 3 likes
  • 4 in conversation