Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3418, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-20-0483c802e9d9>", line 2, in <module> sas_session = saspy.SASsession() File "C:\ProgramData\Anaconda3\lib\site-packages\saspy\sasbase.py", line 465, in __init__ self.sascfg = SASconfig(**kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\saspy\sasbase.py", line 129, in __init__ SAScfg = self._find_config(cfg_override=kwargs.get('cfgfile')) File "C:\ProgramData\Anaconda3\lib\site-packages\saspy\sasbase.py", line 332, in _find_config import sascfg_personal as SAScfg File "C:\ProgramData\Anaconda3\lib\site-packages\saspy\sascfg_personal.py", line 6 'iomhost' :['odaws01-usw2.oda.sas.com','odaws02-usw2.oda.sas.com','odaws03-usw2.oda.sas.com','odaws04-usw2.oda.sas.com'] ^ SyntaxError: invalid syntax
Can we have the output of the following.
import saspy
sas_session = saspy.SASsession()
I hope you are using SAS studio.
If not what is your setup / environment.
It looks like the problem is with your sascfg_personal.py file's syntax for that iomhost option. The example in the default sascfg.py is:
iomlinux = {'java' : '/usr/bin/java', 'iomhost' : 'linux.iom.host', 'iomport' : 8591, }
Should "US" be commented out there?
Also, should there be a comma at the end of your uncommented iomhost line?
Another thought would be separating your different hosts into different configs:
SAS_config_names=['oda','usr','eur','apr'] oda = {'java' : 'C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath\\java.exe', #US Home Region 'iomhost' :['odaws01-usw2.oda.sas.com','odaws02-usw2.oda.sas.com','odaws03-usw2.oda.sas.com','odaws04-usw2.oda.sas.com'], #European Home Region #'iomhost' : ['odaws01-euw1.oda.sas.com','odaws02-euw1.oda.sas.com'], #Asia Pacific Home Region #'iomhost' : ['odaws01-apse1.oda.sas.com','odaws02-apse1.oda.sas.com'], 'iomport' : 8591, 'authkey' : 'oda', 'encoding' : 'utf-8' } usr = {'java' : 'C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath\\java.exe', 'iomhost' :['odaws01-usw2.oda.sas.com','odaws02-usw2.oda.sas.com','odaws03-usw2.oda.sas.com','odaws04-usw2.oda.sas.com'], 'iomport' : 8591, 'authkey' : 'oda', 'encoding' : 'utf-8' } eur = {'java' : 'C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath\\java.exe', 'iomhost' : ['odaws01-euw1.oda.sas.com','odaws02-euw1.oda.sas.com'], 'iomport' : 8591, 'authkey' : 'oda', 'encoding' : 'utf-8' } apr = {'java' : 'C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath\\java.exe', 'iomhost' : ['odaws01-apse1.oda.sas.com','odaws02-apse1.oda.sas.com'], 'iomport' : 8591, 'authkey' : 'oda', 'encoding' : 'utf-8' }
It looks like you are no longer encountering the syntax error...
Try this:
import saspy from IPython.display import HTML sas = saspy.SASsession(cfgname="oda") c = sas.submit(""" proc setinit; run; """) c = sas.submit(""" proc setinit; run; """) HTML(c['LOG'])
The SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment.
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.