Currently I use saspy on my local machine without any issues. I´ve created an file on my workspace called "ConexaoSAS.py", which contain saspy configuration details, and by importing such file to other notebooks I am able to access my sas server.
from SAS.ConexaoSAS import create_sas_session
engine = create_sas_session()
This is my ConexaoSAS.py content:
SASServer = namedtuple("SASServer", ["host", "port", "appserver"])
sasanl = SASServer("sasanl11.XXXX.XXX.com.br", 8593, "")
def create_sas_session(
iomhost: str = sasanl.host,
iomport: int = sasanl.port,
appserver: str = sasanl.appserver,
omruser: str = "",
authkey: str = "",
cfgname: str = "iomwin",
timeout: int = 30,
) -> saspy.SASsession:
""" Cria uma sessão SAS com os parâmetros informados"""
cfgfile = str(Path(__file__).parent / "ConexaoSAS.py")
session = saspy.SASsession(
cfgname=cfgname,
cfgfile=cfgfile,
omruser=omruser,
iomhost=iomhost,
iomport=iomport,
appserver=appserver,
authkey=authkey,
timeout=timeout,
)
return session
SAS_config_names = ["iomwin"]
SAS_config_options = {"lock_down": False, "verbose": True}
iomwin = {
"java": "java",
"iomhost": "",
"iomport": "",
"appserver": "",
"omruser": ""}
Now I need to work on a virtual jupiter notebook enviorement that does not allow me to save a "ConexaoSAS.py" file, so I need to setup saspy and work with it on same notebook.
I am struggling to write a single ipynb that setup and connect to saspy. Is there any limitation to it? I tried to set a single code to set, but not suceeded.
i
import saspy
from collections import namedtuple
SASServer = namedtuple("SASServer", ["host", "port", "appserver"])
sasanl = SASServer("sasanl11.XXXXX.XX.com.br", 8593, "")
iomhost: str = sasanl.host
iomport: int = sasanl.port
appserver: str = sasanl.appserver
omruser: str = ""
authkey: str = ""
cfgname: str = "iom"
timeout: int = 30
session = saspy.SASsession(cfgname=['default'], omruser='', iomhost=sasanl.host, iomport=sasanl.port, appserver=sasanl.appserver, authkey='', timeout=30, lock_down = False, verbose = True)
The SAS Config name specified was not found. Please enter the SAS Config you wish to use. Available Configs are: ['default'] default
The OS Error was:
No such file or directory
SAS Connection failed. No connection established. Double check your settings in sascfg_personal.py file.
Attempted to run program /opt/sasinside/SASHome/SASFoundation/9.4/bin/sas_u8 with the following parameters:['/opt/sasinside/SASHome/SASFoundation/9.4/bin/sas_u8', '-nodms', '-stdio', '-terminal', '-nosyntaxcheck', '-pagesize', 'MAX', '']
If no OS Error above, try running the following command (where saspy is running) manually to see what is wrong:
/opt/sasinside/SASHome/SASFoundation/9.4/bin/sas_u8 -nodms -stdio -terminal -nosyntaxcheck -pagesize MAX