SPSS Community News - new extension command STATS IF

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

SPSS Community News - new extension command STATS IF

Jon K Peck
A new extension command for SPSS Statistics, STATS IF, has been uploaded to the SPSS Community website. This command allows you in essence to apply IF logic to procedure stream execution.  For example, you could write
STATS IF CONDITION1="spss.GetCaseCount() > 100" CONDITION2="True"
/SYNTAX1
"DESC ALL."
"REGRESSION"
"  /DEPENDENT salary"
"  /METHOD=ENTER jobtime educ."
/SYNTAX2
"FREQ ALL.".

It would run DESCRIPTIVES and REGRESSION if there are more than 100 cases and FREQUENCIES otherwise.

It also includes fine-grained error control.  For example, you could use it to log all serious errors to an external file for review and respond to errors dynamically.

The traditional syntax lines must be quoted so that they can be controlled by STATS IF.
The conditions must be Python expressions with inputs from apis as above and variables previously constructed in Python program blocks.

This command even supports conditional macro definition, so it offers an interesting way of letting macros adapt to the data and metadata in a way that is not possible with macro alone (brain damage alert).

All the functionality of this extension could be done with pure Python Statistics code, but this command may be more convenient in many cases.

STATS IF requires the Python Essentials and at least version 18 of Statistics. It can be downloaded from within Statistics using the Utilities menu in version 22. For older versions you can download it from the SPSS Community website (
www.ibm.com/developerworks/spssdevcentral) in the Extension Commands collection.



Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621