Conversion SAS data to pandas dataframe failed with "sasdata" #467
-
I tried several times to get SAS data with the saspy library, but I can't get it even if my saspy connexion seems right. To connect to my SAS serveur : import saspy #(version 1.3.5)
Here is the content of « sascfg_personal.py » : SAS_config_names=['iomcom'] iomcom = { I can access to all the following assigned library : assigned_librefs = sas.assigned_librefs() I can get access to tables :
SAS request works fine and give SAS HMTL results :
libname work listo; proc sql OUTOBS=6; Unfortunately the conversion from SAS data to pandas dataframe failed :
cars.to_df() com_error Traceback (most recent call last) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\saspy\sasdata.py in to_df(self, method, **kwargs) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\saspy\sasbase.py in sasdata2dataframe(self, table, libref, dsopts, method, **kwargs) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\saspy\sasiocom.py in sasdata2dataframe(self, table, libref, dsopts, method, **kwargs) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\saspy\sasiocom.py in read_sasdata(self, table, libref, dsopts) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\saspy\sasiocom.py in _schema(self, table, libref) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\saspy\sasiocom.py in (.0) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\win32com\client\dynamic.py in getattr(self, attr) com_error: (-2147352567, 'Une exception s’est produite.', (0, 'Provider', "Mécanisme d'accès non valide.", None, 1240640, -2147217920), None) Is there something wrong with my SASPY config or with the versionning between my SAS server, SASpy and Pandas? Thanks all for your help Here is my SAS environment (quite old I know) : |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hey, so I think the problem is with using the COM access method. The error is happening somewhere between it and the third party interface it's using to try to interact with SAS. Also, the saspy version you have is a year old, so there could be something that was fixed in that access method since then, but you should really use the IOM access method instead. It works and performs significantly better and has much better functionality (https://sassoftware.github.io/saspy/configuration.html#iom-using-com). Can you get the current version of SASPy and then use the IOM access method; it should resolve whatever is the problem here. Thanks, |
Beta Was this translation helpful? Give feedback.
-
Yes, use IOM and it should all work as expected. COM was a user contribution years ago, and I have no control over how it works, certainly not like my 3 access methods. So just use IOM instead and it should solve whatever this problem happens to be. |
Beta Was this translation helpful? Give feedback.
Hey, so I think the problem is with using the COM access method. The error is happening somewhere between it and the third party interface it's using to try to interact with SAS. Also, the saspy version you have is a year old, so there could be something that was fixed in that access method since then, but you should really use the IOM access method instead. It works and performs significantly better and has much better functionality (https://sassoftware.github.io/saspy/configuration.html#iom-using-com).
Can you try using IOM instead? (https://sassoftware.github.io/saspy/configuration.html#iom-using-java).
The other thing I see is that the encodings don't match, and it could be that there…