title: Reading sas7bdat files with Python's adodbapi
body: <p>I'm trying to read a sas7bdat file from SAS (product of the SAS Institute) into Python.</p>
  
  <p>Yes, I'm a aware that we could export to *.csv files, but I'm trying to avoid that as that will double the number of files we need to create.</p>
  
  <p>There's good documentation for doing this in Visual Basic. Still, I want it in Python. For example, in VB you could write...</p>
  
  <pre><code>Dim cn as ADODB.Connection
  Dim rs as ADODB.Recordset
  
  obConnection.Provider = "sas.LocalProvider"
  obConnection.Properties("Data Source") = "c:\MySasData"
  obConnection.Open
  
  rs.Open "work.a", cn, adOpenStatic, adLockReadOnly, adCmdTableDirect
  </code></pre>
  
  <p>To open your dataset.</p>
  
  <p>But I can't crack the nut to make this work in python. </p>
  
  <p>I can type...</p>
  
  <pre><code>import adodbapi
  
  cnstr = 'Provider=sas.LocalProvider;c:\\MySasData'
  
  cn = adodbap.connect(cnstr)
  </code></pre>
  
  <p>And a can get a cursor...</p>
  
  <pre><code>cur = cn.cur()
  </code></pre>
  
  <p>But beyond that, I'm stumped. I did find a cur.rs, which sounds like a recordset, but it is an object with a type of None.</p>
  
  <p>Also, to preempt some alternative methods...</p>
  
  <ol>
  <li>I do not want to create *.csv files in SAS.</li>
  <li>The computer with Python does not have SAS installed, but does have the Providers for OLE DB installed. I know for a fact that the VB code I provided works without SAS in read-only mode. You can download these drivers here: <a href="http://support.sas.com/downloads/browse.htm?cat=64" rel="nofollow noreferrer">http://support.sas.com/downloads/browse.htm?cat=64</a></li>
  <li>I am not expert in SAS. Honestly, I find their tool cumbersome, confusingly documented, and slow. I noticed that there are some other products listed called "IOMProvider" and "SAS/SHARE". If there's an easier way of doing this using those ADO providers, feel free to document it. However, what I'm really looking for is a way of doing this entirely within Python with a relatively simple bit of code.</li>
  <li>Oh, and I'm aware of Python's sas7bdat package, but we're using Python 3.3.5 and it doesn't seem to be compatible. Also, I couldn't figure out how to use it on 2.7 anyways as there's not a lot of documentation and even a question on how to use the tool, which, to this day, is unanswered. <a href="https://stackoverflow.com/questions/19645852/python-sas7bdat-module-usage">Python sas7bdat module usage</a></li>
  </ol>
  
  <p>Thanks!</p>