If you use Anaconda to program using the SASPy library and you would like to create a SAS session to a SAS server, follow the steps in this note.
Note: These instructions are for connecting from a Microsoft Windows operating system to a SAS server. If you are connecting from a Linux operating system to a SAS server, refer to the Anaconda documentation.
To perform the steps in this note, you need the following:
- Run the following code in a SAS session that is connected to the server that you would like SASPy to connect to:
proc iomoperate;
list types;
run; - In the log results, look for the section regarding the SAS® Workspace Server.
- In the SAS Workspace Server section, record the class identifier.
- Determine the host name for your workspace server. If you are unsure how to find the host name, ask your SAS administrator.
- When you have the host name and the class identifier, you can now start to build the sascfg.py file.
- The sascfg.py file is found in the site-packages location for your Python installation.
- Save a copy of the sascfg.py file in the same folder. You can name the file as sascfg_connection-type.py (for example, sascfg_IOMCOM.py).
- Open the sascfg.py file that you created in step 7.
- On line 38, alter the value for SAS_config_names from default to iomcom.
- On line 215, the value iomcom should appear.
- Update the following values on line 215:
iomcom = {
'iomhost': 'host-name',
'iomport': 8591,
'class_id': 'your-class-id',
'provider': 'sas.iomprovider'} - For the host-name value, enter the host name for the workspace server.
- For the iomport value, the port for the workspace server should be 8591, unless your institution has altered the port.
- For the your-class-id value, enter the class identifier that you recorded in step 3.
- Leave the provider portion unchanged.
- Save the file.
- Connect to the server by using SASPy. When you create your session, reference the new sascfg.py file that was created. Here is an example:
sas = saspy.SASsession(cfgfile='C:\Program Files\Python36\Lib\site-packages\saspy\sascfg_iomcom.py',
user='user-name', pw='password'
If you are still having connection issues, contact SAS Technical Support. Ensure that you attach the sascfg.py file that you created as well as the log response.