Most viewed recipes tagged "value_labels"http://code.activestate.com/recipes/tags/value_labels/views/2009-06-15T15:37:39-07:00ActiveState Code RecipesPython reader for SPSS .por files (Python)
2009-06-15T15:37:39-07:00wouterhttp://code.activestate.com/recipes/users/4170747/http://code.activestate.com/recipes/576809-python-reader-for-spss-por-files/
<p style="color: grey">
Python
recipe 576809
by <a href="/recipes/users/4170747/">wouter</a>
(<a href="/recipes/tags/por/">por</a>, <a href="/recipes/tags/portable/">portable</a>, <a href="/recipes/tags/reader/">reader</a>, <a href="/recipes/tags/spp/">spp</a>, <a href="/recipes/tags/value_labels/">value_labels</a>).
</p>
<p>SPSS can output ASCII .por files that include variable definitions (labels, value labels) and data. These files are useful to be able to read but strange enough I couldn't find any documentation anywhere.</p>
<p>I've reverse engineered the format so that it works for the (fairly complex) files I need to open, so maybe it is of some use for other people interfacing SPSS with python. </p>
<p>This code is placed in the public domain as far as allowed by law, parts (if any) that cannot be relased in the public domain are irrevocably licensed to all readers under the Creative Commons license without restrictions ... but if you improve it it would be great if you could share it. The code uses a base N decoder plucked from the web somewhere (can't find it) that was also public domain.</p>
<p>-- wouter (wouter@vanatteveldt.com)</p>