Skip to content
Advertisement

Import SAS data file into python data frame

I’m working on a data set (PSID) that gives data in a SAS format (a .txt and another file containing instructions to interpret the data). I cannot find anything in Python to read this type of data.

Does anyone know of a pre-existing module/script to read SAS data?

Edit (added from a comment to an answer): The data is in ascii/text and the start of a row of data looks like this:

3 10 1015000 150013200 00 002500 00 00

Advertisement

Answer

So I’ve written a package that can import the data. It can be found here:

https://pypi.python.org/pypi/psid_py

It’s my first package, so sorry for the sloppy work. Additionally, it’s only been tested against the PSID data sets and I’m positive that there are mistakes for other SAS formats. However, something’s better than nothing.

Beyond reading in sas data, it will also build a panel data for you, in case you’re into that kind of thing.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement