Please see the image below for my SAS Server Layout. I would like to pull the top table 2020_01_SETTLEMENTS
and place it into a Python data frame. I have successfully established connection between Python and the SAS Server. I have the following code below but I believe where I am going wrong is in the LIBREF
part of the sasdata2dataframe
function. I have listed the error message below as well. Much appreciated to anyone who can tell me where I went wrong. I've also linked the reference material to this function here:
https://sassoftware.github.io/saspy/api.html
Code:
import saspy
import pandas as pd
from IPython.display import HTML
sas = saspy.SASsession(cfgfile=r'C:\Users\P1\Python_Code\sascfg_personal.py')
sasdata2dataframe(table: str = '2020_01_SETTLEMENTS', libref: str = 'BANKMKR', dsopts: dict = None, method: str = 'MEMORY')
Error Message:
File "<ipython-input-18-41bb6a0902ac>", line 1
sasdata2dataframe(table: '2020_01_SETTLEMENTS', libref: str = 'BANKMKR', dsopts: dict = None, method: str = 'MEMORY')
^
SyntaxError: invalid syntax
Although as it is not specified in the manual, I ended up using the following code instead and it worked. I just changed table: str = '2020_01_SETTLEMENTS'
to table='2020_01_SETTLEMENTS'
tempTable = sas.sasdata2dataframe(table='2020_01_SETTLEMENTS', libref='BANKMKR')