BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Peruano81
Calcite | Level 5

Hi, folks,

I have a question I want to run a .sas in linux background. I understand the sentence is

/opt/sas/spre/home/SASFoundation/sas /path/code.sas -log /path/log.log

but when you run sas it doesn't give any promises or anything and when you enter /opt/sas/spre/home/SASFoundation/sas I see that it is a link to different scripts. Could you help me how or where to find the bin/sas

 

Greetings

 

1 ACCEPTED SOLUTION

Accepted Solutions
AnandVyas
Ammonite | Level 13

Never heard of SAS Viya version 9.3. Viya versions are 3.x - https://support.sas.com/en/software/sas-viya.html

 

Can you try the below command: - /opt/sas/spre/home/SASFoundation/sas -sysin /sasdata/storage/batch/code/801_load_inputData.sas -log /var/log/801_load_inputData.log

 

The first screenshot isn't very clear, is the error saying "A connection to Cloud Analytics Services cannot be made" ?

What is the GUI are you using to run this code? Is it SAS Studio?

 

 

View solution in original post

7 REPLIES 7
Kurt_Bremser
Super User

Use this link to run SAS natively (only the installed binaries).

If you want to run SAS in batch in such a way that you get the environment you are used to from SAS Studio or Enterprise Guide, use

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

instead. sasconf is the path where your BI Server configuration tree is located.

This script will read all metadata linked to the SASApp application server context.

Peruano81
Calcite | Level 5

Hello,

 

06022020.JPGYou could help me, it's as if I don't get the environment variables. Instead my .sas works in the graphic environment.

 

Greetings

Tom
Super User Tom
Super User

That picture you posted looks like a SAS log, so it would seem that you were able to run SAS.

What is your question? 

AnandVyas
Ammonite | Level 13

Hi @Peruano81 

 

I think this path should be good enough to run in background in linux - /opt/sas/spre/home/SASFoundation/sas /path/code.sas -log /path/log.log. Just add nohup and & to run it in background. If you are looking for a more neat way, try wrapping the sas code in a shell script and invoke it background or schedule it using cron.

 

since the path has 'spre' in it, I believe you are running this on a Viya platform and you won't have sasbatch.sh script installed.

 

Symlinks for 'sas' binary is SAS way of running sas on the selected encoding during configuration. You can go under .../bin/sas to find all the sas binaries with different encodings like sas_en, sas_dbcs etc. I don't think there is anything as '../bin/sas'

 

Hope this helps!

Peruano81
Calcite | Level 5

Hello @AnandVyas @Tom,

 

That's right @AnandVyas is sas viya 9.3, and I'm running as root, the following.

/opt/sas/spre/home/SASFoundation/sas /sasdata/storage/batch/code/801_load_inputData.sas -log /var/log/801_load_inputData.sas

But if you run it but it doesn't work, when you check the log it gives the indicated messages.

 

07022020.JPG

 

 


This is the script, when you run it via GUI without problems the problem is to do it in shell backgound.

You could help me

 

code /sasdata/storage/batch/code/801_load_inputData.sas

 

07022020-2.JPG

 

Thank you

 

AnandVyas
Ammonite | Level 13

Never heard of SAS Viya version 9.3. Viya versions are 3.x - https://support.sas.com/en/software/sas-viya.html

 

Can you try the below command: - /opt/sas/spre/home/SASFoundation/sas -sysin /sasdata/storage/batch/code/801_load_inputData.sas -log /var/log/801_load_inputData.log

 

The first screenshot isn't very clear, is the error saying "A connection to Cloud Analytics Services cannot be made" ?

What is the GUI are you using to run this code? Is it SAS Studio?

 

 

Kurt_Bremser
Super User

Do NOT run SAS as root, use the same user-id you use when accessing Viya in the "normal" way. Root does not have an entry in metadata, and can't make use of the objects there.

Root is for system maintenance ONLY.

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 4366 views
  • 0 likes
  • 4 in conversation