BookmarkSubscribeRSS Feed
gugukaka
Calcite | Level 5

Is there a way to run a .sas file in the background even when SAS EG is shut down and the PC is turned off? I'm currently looking for a way to do it on Linux.

6 REPLIES 6
SASKiwi
PROC Star

Yes, you run SAS in batch mode on a SAS server: https://documentation.sas.com/?docsetId=hostunx&docsetTarget=n0x9esc5c95qg4n1wogx5u2k7354.htm&docset...

 

The easiest way to do this is via a scheduling tool. Often this can be done using SAS Management Console which contains a Schedule Manager for setting up, running and scheduling SAS batch jobs: https://documentation.sas.com/?docsetId=scheduleug&docsetTarget=p1st3swwtt231jn1ramd8tsx9ijw.htm&doc...

gugukaka
Calcite | Level 5

The sas command cannot be found at this time. Is there another way in this case ??

SASKiwi
PROC Star

Please post what you actually typed in at the linux command line. On Unix typing ./sas instead of just sas will often work.

Kurt_Bremser
Super User

@gugukaka wrote:

The sas command cannot be found at this time. Is there another way in this case ??


If you get a message like

/usr/bin/bash: sas:  not found.

this means that the path to the SAS executable is not in your PATH environment variable.

If you have a BI Server setup (EG connects to SASApp or similar), then it's best to use

/sasconf/Lev1/SASApp/BatchServer/sasbatch.sh

to run your codes, as this will provide the same environment that your code uses in EG. Replace the first part (/sasconf) with the absolute (starts with /) path to your SAS configuration tree.

Kurt_Bremser
Super User

Only if you are working with SAS on a remote server.

Make your code batch-runnable (direct exports instead of such done through the EG wizard, for one), and run it with the server's sasbatch.sh at the time of your choosing. If your server is included in a wider scheduling solution, use that.

 

So the next thing we need to know is your SAS setup. Number of tiers, operating systems, ...

Satish_Parida
Lapis Lazuli | Level 10

On Linux, you can schedule a Cron and call you SAS using the SAS executable and YourProgram File as follows.

 

/u01/dev01sas/SAS9_4_HOME/SASFoundation/9.4/bin/sas_u8 YourProgram.sas

 

This is an example how to call a SAS program. This can be scheduled to run on back ground. Or you can call  the command from a shell command window.

 

Please let us know if it helped.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1594 views
  • 0 likes
  • 4 in conversation