StATS: Extending SPSS capabilities using Python (January 19, 2006)

Version 14 of SPSS allows you to incorporate external programming languages into SPSS syntax. According materials on the SPSS web page,

Combining the new backend processor APIs with an external programming or scripting language opens up a limitless set of new possibilities from within SPSS syntax jobs. Use the new SPSS Programmability Extension to control the flow of your SPSS command syntax jobs through conditional execution control statements (such as “If/Then/Else”) and looping control statements (such as “For” and “While”). These types of statements are available in almost all external programming languages. Use scripts written in external programming languages to conditionally execute or make decisions about which syntax is executed based on a particular condition, such as: The value of the variable attributes in the data dictionary; A value in the output; A value in the active dataset; Error-level return codes from SPSS procedures. In short, you can create reusable code that speeds the process of turning data into decisions.

This sort of thing is not for the faint of heart. SPSS has built an interface between their command syntax, and a program called Python, and with a bit of effort, you could build a similar interface to other programs. Apparently, you can use Python to create bootstrap estimates from any SPSS procedure. I will look for details of this when I get a chance. I would also be interested in seeing if you could use Python to run randomization tests.

I have to wonder if the time spent getting SPSS to work with Python might not be better invested in learning more about a program like R or Stata that can do things like bootstrap estimates without having to resort to an external program.

Additional resources:

This page was written by Steve Simon while working at Children's Mercy Hospital. Although I do not hold the copyright for this material, I am reproducing it here as a service, as it is no longer available on the Children's Mercy Hospital website. Need more information? I have a page with general help resources. You can also browse for pages similar to this one at Category: SPSS software.