BookmarkSubscribeRSS Feed
reginado
Fluorite | Level 6

Hi,

I need to run SAS code remotely on a Linux server.

I have a code that runs a long time, and I need to execute this code on the remote machine (Linux), without using the remote desktop connection, so I can turn off my local computer and let the code process remotely.

 

Could you please suggest if there is a way how this can be done, if possible?

 

Thanks a lot in advance.

 

With best regards,

RD 

11 REPLIES 11
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Is SAS installed on the Linux server in any form?

reginado
Fluorite | Level 6

Yes, SAS is installed on the Linux server.

Kurt_Bremser
Super User

With a server-based SAS, you usually have the configuration tree somewhere (BI Server). Something like /sasconf/Lev1/.....

Within that, you find the subtree for the SASApp application server; within that, there's a Batchserver directory that contains the sasbatch.sh script.

This shell script can be used to run batch jobs in the context of the SASApp server.

 

Convert your SAS code to a .sas file; save it in an appropriate place (eg subdirectory sasprog in your home directory)

Do a test run (maybe with a smaller program that finishes quickly):

/sasconf/Lev1/SASApp/BatchServer/sasbatch.sh $HOME/sasprog/myprog.sas -log $HOME/sasprog/myprog.log

Review the log file. If everything is OK, you can apply this to run in the background:

nohup /sasconf/Lev1/SASApp/BatchServer/sasbatch.sh $HOME/sasprog/myprog.sas -log $HOME/sasprog/myprog.log &

The & at the end redirects the job into the background; running it with nohup means that a disconnection of the telnet/ssh connection will not terminate the job. Any stdout output will be directed to the file nohup.out in the directory from where you called that commandline.

reginado
Fluorite | Level 6
Thanks a lot KurtBremser!
Kurt_Bremser
Super User

Note that it is necessary to supply absolute path names for programs and logs (starting with a forward slash). $HOME provides this (resolves usually to /home/username)

FredGIII
Quartz | Level 8

Kurt,

 

This process requires the user to have direct access to log into the Application server to be able to submit a batch job.  Is there any way that a user can submit a batch job directly from their remote client (not including creating a DI Studio job)?  Our users would like to be able to run a long running program in batch, so they can shut down their computers and then check on the status later.  But would prefer to remotely submit the batch program.  I have a feeling that this isn't possible at this time.

 

Regards,


Fred

SASKiwi
PROC Star

The SAS Management Console client tool provides the functionality to submit SAS batch jobs on your remote SAS application server using Schedule Manager.

Kurt_Bremser
Super User

UNIX provides tools for this:

nohup /sasconf/Lev1/SASApp/BatchServer/sasbatch.sh $HOME/sas/myprog.sas -log $HOME/log/myprog.log &

The & at the end sends the command to the background, and the nohup wrapper prevents a premature termination when the terminal connection breaks.

Kurt_Bremser
Super User

If that remote Linux server is your SAS server, then look at background processing (with &) and the nohup command. You have to convert your SAS code to a batch job first (a .sas file that contains all your code and will run from the command line; additional use of configuration will be necessary, depending on your SAS environment)

If SAS is not on the remote server, no luck.

chenchug
Calcite | Level 5

Hi Kurt,

 

I have couple of users, they want to run SAS Program on remote Linux SAS Server as backend process using SAS EG.

 

SAS EG has been installed on Windows 10, then users connect to SAS Server(to remote Linux) to access code/data and run programs.

How to enable users to schedule the sas code to run on remote Linux SAS Server as backend process at after business hours?

 

Thank,

CG

Kurt_Bremser
Super User

As long as you do not run SAS with token authentication (and a generic user on the backend), there's really nothing you must do. Users save their code to .sas files on the server, log on to the server with any SSH client, and use the method I described previously to run the code in batch. Once it is verified that the code does run in batch correctly, you can use the UNIX system's cron tool to schedule the jobs.

Search the net for the documentations of the at and crontab commands.

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
  • 11 replies
  • 4510 views
  • 1 like
  • 6 in conversation