Desktop productivity for business analysts and programmers

Batch Job

Posts: 22

Batch Job

I have searched the forum on submit batch job in EG so that i can log off/ switch down my PC and later on check back the result some time later.

Many of those saying this feature will be included in the future release, i am wondering is 4.2 / 4.3 EG have these feature yet?

Besides, some of the posts suggest instead to submit a batch job, a scheduler can also do a similar effect. I wonder what module/license will be needed for the scheduler and can i trigger the schedule by sas code? Try so, please provide some example for reference. Also, is there any other method which can let the sas program run in server while user PC can switch off or log off and later on can check back the result?

Any suggestions will be great Thanks!!
Super User
Posts: 4,013

Re: Batch Job

In my experience SAS batch jobs work best if your SAS job is just a text file of SAS code. You can export your EG projects to code text files, then you could use the Windows scheduler (check out the Control Panel) to run the SAS job. The trick is to define a command line like: sas -sysin "\mydir\". Separate OUTPUT and LOG files are produced automatically.
Posts: 22

Re: Batch Job

After some search in the web, i found that the "sas.exe" is not followed with Enterpirse Guide, but PC SAS (X.X). If my PC only installed with EG, i actually cannot use the trick at all.

with server machine nocmd, no pipe setting, noxwait, is it the only with to submit batch job is via my own pc / server pc windows' scheduler? (server pc and my pc is both windows platform)

Thanks in advance...
Super User
Posts: 4,013

Re: Batch Job

In your case then you want to run server-based batch jobs. I suggest you ask your server administrator if remote desktop connections are allowed on your server. If they are then you can log onto the server and show a server Windows session just like your desktop. You can then try running a SAS batch job from the command line as already described.

If remote desktop connections are not allowed I suspect you have few options left, except asking if you can get x-type commands enabled.

Check out this link:

Message was edited by: SASKiwi Message was edited by: SASKiwi
Respected Advisor
Posts: 4,779

Re: Batch Job


PC SAS is kind-of a locally installed SAS Server with a windows system, EG is only a SAS client.

If you would have PC SAS installed on your local machine then you would see a Server Local in EG.

In order to submit SAS code in batch from EG you must be able to execute OS commands (shell escape). To do so in EG the option "xcmd" must be set (you can check this by submitting Proc Options; runSmiley Wink. For EG the default is "noxcmd".

If you are allowed to execute OS commands then exporting the EG code on the server (store it somewhere in "Files") and then executing this code using %sysexec() should work.

What I'm not sure about is if the batch job would continue to run if you terminate your SAS session. The batch job submitted via %sysexec() is a child process of your SAS session and it will depend on how SAS submits this code with %sysexec(). You sure would have the best chances that the child "survives the termination of the parent" if you also use options noxsynch and noxwait.
As I never tried to batch this way and to disconnect my EG session I can't tell what happens.

If your server is Windows then another way would be the remote desktop (which means you work directly on the server).
If it's UNIX then people use normally Putty for batch jobs (a UNIX command promt which can be downloaded from Internet).

Again: You would first export your EG project and store it in a .sas file - and then execute this SAS file by "feeding" it to sas.bat (Windows) or (Unix).

A issue you can have with EG exported code in batch: EG tends to add a lot of its own "garbadge" to the code which is normally not needed in batch. Problem is that some of the EG used macros might not be available in a batch environment (where you also might use another user). Some additional coding effort will most likely be necessary - either by assigning the EG macro library or by cleaning the EG generated code.

Using a scheduler would only make sense if you have some stable code which has to be executed regularly.
Something like this is then more going into a operational area where you might be the developer and tester but then hand it over to operations and they integrate it in a scheduler and monitor the process.


Message was edited by: Patrick
Posts: 22

Re: Batch Job

Thx for all sharing your valuable experience on submitting batch job through EG environment. I have figured out my server with noxcmd, i.e. i cannot trigger the batch through SYSTASK, FILENAME PIPE and also my client does not have Connect module so i cannot submit by RSUBMIT also.

I, however, can submit batch with the SASCBTBL module triggering with winexec api, which i come across this approach when i search through another post in this forum. But still schedule the batch job on server directly might be my final solution as my boss said it is simply enough. As SASCBTBL might need to implement additional job status checking whilst using scheduler can simply see the scheduler history.

Thanks for all great help.
Ask a Question
Discussion stats
  • 5 replies
  • 3 in conversation