5

Am new to Python and looking for a solution to read/write xpt file(SAS data set) using Python.

I got to know its possible using Python from this link. But then the code is not working as expected. Anything missing in this code, whether to include any library or to install any library. Or even any syntax error in this code.

with open('example.xpt', 'rb') as f:
for row in xport.Reader(f):
    print row

Note: Am familiar with PHP scripting.

Please help me with suitable solution.

V-T
  • 756
  • 2
  • 9
  • 22

1 Answers1

8

You need to import the package to use xport

Import xport

And have to install the package by

sudo pip install xport
Naresh Kumar
  • 1,706
  • 1
  • 14
  • 26