I am trying to configure saspy to connect to SAS On Demand for Academics via Pycharm on Mac OS 12.3.1 (Monterey). I have set up sascfg_personal.py as directed here. See contents below.
SAS_config_names=['oda']
oda = {'java' : '/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home',
#US Home Region 1
'iomhost' : ['odaws01-usw2.oda.sas.com','odaws02-usw2.oda.sas.com','odaws03-usw2.oda.sas.com','odaws04-usw2.oda.sas.com'],
#US Home Region 2
#'iomhost' : ['odaws01-usw2-2.oda.sas.com','odaws02-usw2-2.oda.sas.com'],
#European Home Region 1
#'iomhost' : ['odaws01-euw1.oda.sas.com','odaws02-euw1.oda.sas.com'],
#Asia Pacific Home Region 1
#'iomhost' : ['odaws01-apse1.oda.sas.com','odaws02-apse1.oda.sas.com'],
#Asia Pacific Home Region 2
#'iomhost' : ['odaws01-apse1-2.oda.sas.com','odaws02-apse1-2.oda.sas.com'],
'iomport' : 8591,
'authkey' : 'oda',
'encoding' : 'utf-8'
}
When running:
from saspy import SASsession
sas = saspy.SASsession()
I get the following error (no java error) with direction to run a few very long commands for diagnostic purposes.
The OS Error was:
No such file or directory
SAS Connection failed. No connection established. Double check your settings in sascfg_personal.py file.
Long story short, when running the recommended commands in Terminal, all looks fine except:
-bash: odaws02-usw2.oda.sas.com: command not found
-bash: odaws03-usw2.oda.sas.com: command not found
-bash: odaws04-usw2.oda.sas.com: command not found
Apparently odaws01-usw2.oda.sas.com is found? I'm out of my depth in solving this issue and I'm grateful for any insight!
Hey, the error you got is about java not being found. https://sassoftware.github.io/saspy/troubleshooting.html#java-problems
You show
'java' : '/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home',
for java, which isn't java, so that's for sure the first problem. Also, I would issue
`import saspy'
not
`from saspy import SASsession'
Not sure where you saw that. Import the package.
And set the java config to an actual java.exe (java executable; can't tell if you are on windows or what). You provided an authkey config value; did you put your credentials in the authinfo file (that the next thing once you point to a real java).
Then give it another try.
I'm on a Mac, which is usually the source of my problems, so I don't have java.exe. Any idea what I'm looking for?
So, it won't have the windows .exe extension as part if it's filename, but Mac's can still have java installed, it's just the executable you need the path of. it would just be named java, in some directory where it's installed. I don't do 'I' things (Mac's are included in that), so I don't know where it would be installed or how you navigate the file system on that. I googled how to find the path to java on a mac and got this hit: https://stackoverflow.com/questions/15826202/where-is-java-installed-on-mac-os-x along with plenty others. You ought to be able to find it on the filesystem if it's already installed, or just install it and then be able to see where it is.
the 'java' default key location for mac is '/usr/bin/java' so the line in your sascfg_personal.py config file should be
'java' : '/usr/bin/java',
If for some reason you don't have java install I would install it via homebrew.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.