New SAS User

Completely new to SAS or trying something new with SAS? Post here for help getting started.
BookmarkSubscribeRSS Feed
kharvel
Calcite | Level 5

After careful research & troubleshooting, I have followed all the steps required to establish a SASPY connection to ODA (Ondemand for Academics) and I am still having trouble connecting.  I have already installed the SAS IOM encryption jars (https://support.sas.com/downloads/package.htm?pid=2494) so that would eliminate the encryption as an issue.

 

Below is the sascfg_personal.py

SAS_config_names=['oda']
oda = {'java' : 'C:\\Users\\rsheth\\Java\\jdk-23.0.1\\bin\\java.exe',
#US Home Region 2
'iomhost' : ['odaws01-usw2-2.oda.sas.com','odaws02-usw2-2.oda.sas.com'],
'iomport' : 8591,
'authkey' : 'oda',
'encoding' : 'windows-1252'
}

And below are the python commands I used to start the SAS session to ODA:

import pandas as pd
import saspy
sas=saspy.SASsession()

Now, I get the following error message:

Using SAS Config named: oda
We failed in getConnection


SAS process has terminated unexpectedly. RC from wait was: 4294967290

---------------------------------------------------------------------------
SASIOConnectionTerminated                 Traceback (most recent call last)
Cell In[1], line 3
      1 import pandas as pd
      2 import saspy
----> 3 sas=saspy.SASsession()

File ~\AppData\Local\anaconda3\Lib\site-packages\saspy\sasbase.py:594, in SASsession.__init__(self, **kwargs)
    592         raise SASIONotSupportedError(self.sascfg.mode, alts=['IOM'])
    593 elif self.sascfg.mode == 'IOM':
--> 594     self._io = SASsessionIOM(sascfgname=self.sascfg.name, sb=self, **kwargs)
    595 elif self.sascfg.mode == 'COM':
    596     self._io = SASSessionCOM(sascfgname=self.sascfg.name, sb=self, **kwargs)

File ~\AppData\Local\anaconda3\Lib\site-packages\saspy\sasioiom.py:317, in SASsessionIOM.__init__(self, **kwargs)
    314 self._tomods1 = b"_tomods1"
    315 self.sascfg   = SASconfigIOM(self, **kwargs)
--> 317 self._startsas()
    318 self._sb.reconuri = None

File ~\AppData\Local\anaconda3\Lib\site-packages\saspy\sasioiom.py:582, in SASsessionIOM._startsas(self)
    580 if enc == '':
    581    self.sascfg.encoding = 'utf-8'
--> 582 ll = self.submit("options svgtitle='svgtitle'; options validvarname=any validmemname=extend pagesize=max nosyntaxcheck; ods graphics on;", "text")
    583 self.sascfg.encoding = enc
    585 if self.pid is None:

File ~\AppData\Local\anaconda3\Lib\site-packages\saspy\sasioiom.py:988, in SASsessionIOM.submit(self, code, results, prompt, **kwargs)
    986    #return dict(LOG=log.decode(errors='replace'), LST='')
    987    logger.fatal(log.decode(errors='replace'))
--> 988    raise SASIOConnectionTerminated(Exception)
    989 except subprocess.TimeoutExpired:
    990    pass

SASIOConnectionTerminated: No SAS process attached. SAS process has terminated unexpectedly.
<class 'Exception'>

I would appreciate your assistance in troubleshooting and fixing the issue so that I can submit SAS code through python. Thank you!

7 REPLIES 7
AhmedAl_Attar
Ammonite | Level 13

Hi @kharvel 

check this documentation link:

https://sassoftware.github.io/saspy/configuration.html#attn-as-of-saspy-version-3-3-3-the-classpath-...

This how to link: https://support.sas.com/ondemand/saspy.html

 

Using a text editor, we recommend you create two files:

"sascfg_personal.py"

"_authinfo"

 

Hope this helps

kharvel
Calcite | Level 5

Hello AhmedAl_Attar,

 

Thank you for responding.  I already used the documentation you linked to set up the saspy configuration (including the sascfg_personal.py and _authinfo).   All of that appears to be set-up correctly.  The error does not appear to be related to the configuration set-up.  Do you have any insights into what the error messages are indicating?

Tom
Super User Tom
Super User

Why does the error message say utf-8 but the config file does not?

Are you sure that you machine allows you to connect to that port on the ODA server? Perhaps your company firewall or your PC config is blocking that port?

sastpw
SAS Employee

The firewall thought is a good one. What's strange is that for various failures I can cause, they all provide some error message between what you had:

We failed in getConnection


SAS process has terminated unexpectedly. RC from wait was: 4294967290

 for instance, providing the wrong machine name:

 

>>> sas = saspy.SASsession(cfgname='oda', iomhost='bob')

We failed in getConnection
The application could not log on to the server "bob:8591". The machine name is not valid.

SAS process has terminated unexpectedly. RC from wait was: 4294967290

 

Since there is no actual error message coming back, it's likely you aren't getting to the ODA system. Since you're failing where you are, it seems Java is valid and found and starting up. So, I think looking into something like 'you can't get there from here' is the next step. Can you connect to ODA using other means like studio or EG from the same client machine?

kharvel
Calcite | Level 5

Hi, I do not have SAS Studio or SAS EG installed.  In fact, I don't have anything SAS installed on my machine.  The only thing installed is python, Anaconda, and saspy

 

I am indeed behind a corporate firewall.  Would a restrictive firewall cause this issue? 

sastpw
SAS Employee

Yes, a firewall can cause that problem. Do you have a computer at home, or not behind the corporate firewall to just try? Or do you have IT that can help with that? 

SASKiwi
PROC Star

It would be worthwhile trying SODA via SAS Studio in your environment. This runs in a web browser so there is no installation required. If you have a firewall issue then SAS Studio will also fail but it might be easier to troubleshoot. If it does work, then you don't have a firewall issue and the problem is with the SASpy configuration.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 7 replies
  • 1340 views
  • 0 likes
  • 5 in conversation