Python Extension Commands for SPSS Statistics

IBM® SPSS® Statistics - Essentials for Python, which is installed by default with your IBM SPSS Statistics product, includes a set of extension commands that are implemented in Python and that provide capabilities beyond what is available with built-in SPSS Statistics procedures. Each extension command has an associated dialog box that generates command syntax for the command and is available from the SPSS Statistics menus. The extension commands can also be run from SPSS Statistics command syntax in the same manner as any built-in command such as FREQUENCIES.

Table 1. Listing of Python extension commands
Menu location Command name Description
Data>Case Control Matching FUZZY Perform exact or fuzzy case-control matching.
File>Collect Variable Information GATHERMD Build a dataset of variable information from multiple datasets.
Analyze>Regression>Partial Least Squares PLS Partial least squares regression.
Data>Propensity Score Matching PSM Propensity score matching.
Transform>Anonymize Variables SPSSINC ANON Anonymize variables and data
Utilities>Censor Table SPSSINC CENSOR TABLES Censor cells of a pivot table that is based on the values of a test statistic.
Transform>Create Dummy Variables SPSSINC CREATE DUMMIES Create a set of dummy variables that represent the values of a variable.
File>Open>Internet Data SPSSINC GETURI DATA Open an SPSS, Excel, SAS, or Stata dataset from a web url.
Utilities>Merge Viewer Tables SPSSINC MERGE TABLES Merge the contents of a pivot table in the Viewer into another.
Utilities>Process Data Files SPSSINC PROCESS FILES Apply a file of syntax to a set of data files.
Edit>Search Data Files SPSSINC PROCESS FILES SEARCH Search the cases in a set of SPSS Statistics data files.
Utilities>Run Python Program SPSSINC PROGRAM Extension command to run arbitrary Python programs without turning them into extension commands.
Data>Rake Weights SPSSINC RAKE Calculate weights to control totals in up to 10 dimensions by rim weighting, that is, raking.
Utilities>Define Variable Macro SPSSINC SELECT VARIABLES Define a macro listing variables selected according to variable dictionary properties.
Data>Split into Files SPSSINC SPLIT DATASET Split a dataset into separate files according to splitting variables.
Analyze>Compare Means>Summary Independent-Samples T Test SPSSINC SUMMARY TTEST Calculate a t test from sample summary information.
Transform>Programmability Transformation SPSSINC TRANS Apply a Python function to case data.
Analyze>Descriptive Statistics>TURF Analysis SPSSINC TURF Perform a TURF (Total Unduplicated Reach and Frequency) analysis.
Data>Adjust String Widths Across Files STATS ADJUST WIDTHS Adjust widths of string variables across files.
Analyze>Correlate>Canonical Correlation STATS CANCORR Calculate canonical correlations.
Data>Cartesian Product STATS CARTPROD Compute the Cartesian product of two sets of variables.
Analyze>Custom Tables>Define Category Order STATS CATEGORY ORDER Create a macro or multiple dichotomy set with a specified variable order.
Analyze>Classify>Cluster Silhouettes STATS CLUS SIL Compute silhouette measure for cluster analysis.
Data>Define Date from Data STATS DATA DATE Define date structure based on dataset values.
File>Manage Datasets STATS DATASET Combine several DATASET commands into one.
File>Read Triple-S Data STATS GET TRIPLES Read a file in Triple-S format.
Utilities>Conditionally Execute Code Blocks STATS IF Execute blocks of code conditionally.
Analyze>Custom Tables>Convert Multiple Category Set STATS MCSET CONVERT Convert a multiple category set to a multiple dichotomy set.
File>Open>Project STATS OPEN PROJECT Open a project
File>Set Viewer Output Options (Syntax) STATS OUTPUT ATTRS Set Viewer page attributes and setup from syntax.
Graphs>Regression Variable Plots STATS REGRESS PLOT Plots useful in assessing regression relationships.
Utilities>Play Sound STATS SOUND Play selected sound.
Graphs>Compare Subgroups STATS SUBGROUP PLOTS Graphically compare the distributions of a set of variables across a partition of the data.
Utilities>Calculate with Pivot Table STATS TABLE CALC Calculate with pivot table cells.
Data>Create Value Labels from Data STATS VALLBLS FROMDATA Create value labels for variables from data.
Graphs>Weibull Plot STATS WEIBULL PLOT Create Weibull probability plot for failure data.
Utilities>Create Text Output TEXT Create a text block in the Viewer, optionally with formatted text.
Data>Simulate Active Dataset No command. Dialog only. Generate a new dataset from variable distributions in the active dataset.

Notes

  • Help for each of the Python extension commands is available by clicking Help on the associated dialog box. The help is not, however, integrated with the SPSS Statistics Help system.
  • Complete syntax help for each of the extension commands is available by positioning the cursor within the command (in a syntax window) and pressing the F1 key. It is also available by running the command and including the /HELP subcommand. For example:
            STATS TABLE CALC /HELP.

    The command syntax help is not, however, integrated with the SPSS Statistics Help system and is not included in the Command Syntax Reference.

  • If the menu location that is specified for an extension command is not present in your IBM SPSS Statistics product, then look on the Custom menu for the associated dialog.
  • The dialogs were created with the Custom Dialog Builder in IBM SPSS Statistics. You can view the design for any of the dialogs and you can customize them using the Custom Dialog Builder. It is available from Utilities>Custom Dialogs>Custom Dialog Builder. To view the design for a dialog, choose File>Open Installed from within the Custom Dialog Builder.
  • The implementation code (Python modules) and XML specification files for each of the Python extension commands can be found in the location where extension commands are installed on your computer. To view the location, run the SHOW EXTPATHS syntax command. The output displays a list of locations under the heading "Locations for extension commands". The files are installed to the first writable location in the list.
  • Other extension commands that are not included in IBM SPSS Statistics - Essentials for Python are available for download from the Download Extension Bundles dialog, accessible from Utilities>Extension Bundles>Download and Install Extension Bundles. The Download Extension Bundles dialog also displays any updates that are available for the extension commands included with IBM SPSS Statistics - Essentials for Python in addition to updates for any other extension bundles that you installed.
  • If you are installing extension bundles on SPSS Statistics Server, you can use a script to install multiple extension bundles at once. For information, see Core System > Utilities > Extension bundles > Installing local extension bundles > Batch installation of extension bundles in the Help system.