BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
MariaD
Barite | Level 11

Hi folks.

 

We're using Azure ML Notebooks and we need to connect with our SAS 9.4 server. I already installed saspy on Azure ML Notebooks using the command pip install saspy successfully. 

 

Anyone knows where the sascfg_personal.py is located and how to configure it? 

 

Regards, 

1 ACCEPTED SOLUTION

Accepted Solutions
sastpw
SAS Employee

And, since you can override any of the configuration definition keys on the SASsession() method, you can simply supply what you need on it, overriding the 'default' config which will be used (by default) if you have no config file. In fact, you can do something as simple as the following to make it easy to test out before creating a sascfg_personal.py file wherever you might be able to create a file out there:

 

 

oda      = {'java'      : '/usr/bin/java',
             'iomhost'  : ['odaws01-usw2-2.oda.sas.com','odaws02-usw2-2.oda.sas.com',
                           'odaws01-usw2.oda.sas.com','odaws02-usw2.oda.sas.com','odaws03-usw2.oda.sas.com','odaws04-usw2.oda.sas.com'],
            'iomport'   : 8591,
            }

import saspy
sas = saspy.SASsession(**oda)
sas

>>> sas
Access Method         = IOM
SAS Config name       = default
SAS Config file       = /opt/tom/github/saspy/saspy/sascfg_personal.py
WORK Path             = /saswork/SAS_work9A2D00013BDA_odaws03-usw2.oda.sas.com/SAS_work0E1100013BDA_odaws03-usw2.oda.sas.com/
SAS Version           = 9.04.01M6P11072018
SASPy Version         = 4.3.5
Teach me SAS          = False
Batch                 = False
Results               = Pandas
SAS Session Encoding  = utf-8
Python Encoding value = utf_8
SAS process Pid value = 80858


>>>

The full config doc is here, btw: configuration

 

View solution in original post

5 REPLIES 5
sastpw
SAS Employee

And, since you can override any of the configuration definition keys on the SASsession() method, you can simply supply what you need on it, overriding the 'default' config which will be used (by default) if you have no config file. In fact, you can do something as simple as the following to make it easy to test out before creating a sascfg_personal.py file wherever you might be able to create a file out there:

 

 

oda      = {'java'      : '/usr/bin/java',
             'iomhost'  : ['odaws01-usw2-2.oda.sas.com','odaws02-usw2-2.oda.sas.com',
                           'odaws01-usw2.oda.sas.com','odaws02-usw2.oda.sas.com','odaws03-usw2.oda.sas.com','odaws04-usw2.oda.sas.com'],
            'iomport'   : 8591,
            }

import saspy
sas = saspy.SASsession(**oda)
sas

>>> sas
Access Method         = IOM
SAS Config name       = default
SAS Config file       = /opt/tom/github/saspy/saspy/sascfg_personal.py
WORK Path             = /saswork/SAS_work9A2D00013BDA_odaws03-usw2.oda.sas.com/SAS_work0E1100013BDA_odaws03-usw2.oda.sas.com/
SAS Version           = 9.04.01M6P11072018
SASPy Version         = 4.3.5
Teach me SAS          = False
Batch                 = False
Results               = Pandas
SAS Session Encoding  = utf-8
Python Encoding value = utf_8
SAS process Pid value = 80858


>>>

The full config doc is here, btw: configuration

 

MariaD
Barite | Level 11
Thanks!
MariaD
Barite | Level 11

Hi @sastpw , a quick question. In the example that you share, is it necessary the "**" before the name o "oda" variable?

 

 

Regards, 

sastpw
SAS Employee

Hey, sorry, I was out on vacation. Yes, **kwargs is a standard Python convention for a method signature. To pass individual keyword arguments you code it like this:

Given the method definition: class saspy.SASsession(**kwargs)

sas = saspy.SASsession(java = '/usr/bin/java', iomhost = ['odaws01-usw2-2.oda.sas.com','odaws02-usw2-2.oda.sas.com', 'odaws01-usw2.oda.sas.com','odaws02-usw2.oda.sas.com','odaws03-usw2.oda.sas.com','odaws04-usw2.oda.sas.com'], iomport = 8591)

Or, to pass a dict of kwargs you use the **dict syntax:

sas = saspy.SASsession(**dict)

That's just Python syntax, nothing unique having to do with saspy.

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
  • 5 replies
  • 945 views
  • 1 like
  • 3 in conversation