Search code examples
pythonsas

How to connect Python to a SAS Enterprise Guide (EG) Server


For normal SAS software, one can use the Python package SASPy inorder to connect to a SAS server, retrieve data and manipulate the data with Python code. However, this package does not seem to work for SAS EG. Does anyone know how to import data from SAS EG servers in a Python IDE?

For example:

SAS EG Server name: Server1
Table name: Table1

What code would you run in a Python IDE to print that table from SAS EG


Solution

  • This hyperlinked document was very helpful in allowing me to figure this out. It required two files. One cfg file to host the server info. And another file to create a SASsession that referenced the cfg file. For the Windows IOM server I used the code below:

    https://sassoftware.github.io/saspy/install.html#choosing-an-access-method

    # Windows client and Windows IOM server
    winiomwin   = {'java'      : 'java',
                   'iomhost'   : 'windows.iom.host',
                   'iomport'   : 8591,
                   'encoding'  : 'windows-1252',
                  }