Quickly import custom SPSS commands from Python

萝らか妹 提交于 2019-12-05 19:21:43

There are several possible solutions. If you want to have a standard set of Python functions loaded automatically, you can create a startup script. It would be named StartClient_.py and placed in the scripts directory under the Statistics installation. That will be executed each time Statistics is launched. (This can be generalized using the STATS OPEN PROJECT extension command that can do a lot of things when it is invoked, including writing a startup script.)

Another solution if you just want users to be able to run Python functions without facing any Python code or BEGIN/END program is to use the SPSSINC PROGRAM extension command (Utilities > Run Python Program). It take a module and function to run and whatever parameters you want to specify.

Here's an example: SPSSINC PROGRAM testpgm.mypgn x=age y = income z=.05.

As the developer, to make this work see the syntax help for this command. The command loads the module and passes the parameters to your code using sys.argv.

If you have mostly point and click users, you could just create a few custom dialog boxes that hold the Python code and have users install them.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!