Introduction to extension commands
Extension commands wrap programs that are written in the Python programming language, R, or Java in custom IBM® SPSS® Statistics command syntax. You design the syntax for your extension command based on the parameters that are required by the underlying Python, R, or Java code. When syntax for your command is run, the values that are specified in the syntax are passed to the underlying code. Extension commands require the SPSS Statistics Integration Plug-in for the language in which the command is implemented (Python, R, or Java).
The following figure provides an overview of the extension command mechanism. Briefly, command syntax for an extension command is submitted by a user and is parsed by SPSS Statistics, based on an XML representation of the syntax for the extension command. The parser calls the implementation code (written in Python, R, or Java) to process the parsed syntax and perform the requested actions, which might include generating tabular or graphical output.

As an author of an extension command, you are responsible for creating the XML specification of the syntax for the command and the implementation code. If you plan to share the extension command with other users, then you probably want to include documentation for the command. Information on creating the XML specification, the implementation code, and the documentation is provided in the sections that follow.
You can also create a custom dialog that generates the command syntax for your extension command so that users who do not typically use command syntax can easily run your extension command. Extension commands and custom dialogs can be packaged in extension bundles, which can be easily installed by users. For an example of creating a custom dialog for an extension command, which is implemented in R, see the tutorial "Working with R" in the SPSS Statistics help system.
How you approach the task of creating an extension command depends somewhat on what you are implementing. For example, if you are wrapping an R package, then you might start with the implementation code, and then design the syntax for the extension command based on the parameters that you are supporting in the underlying R functions. However, if you are developing all of the implementation code yourself then you might start at the higher-level of the syntax or custom dialog design. If you do plan to create a custom dialog for your extension command, then you might want to design the custom dialog before you design the syntax because it is possible to design syntax that is difficult to generate from a custom dialog.