Skip to content
Advertisement

Convert SAS data to a python dataframe

I have this small little code here to import a SAS file into dataframe in Python.

JavaScript

The code runs forever without any output. The sas file I’m trying to import is 1.5gb.

Advertisement

Answer

You should use the native pandas function pandas.read_sas it’s faster than iterating through the file as you did.

Here is the documentation of the pandas.read_sas function. This code sample should be sufficient to load the file:

JavaScript
Advertisement