# SPSS Extension Bundles in the SSCC

## Background

It has long been possible to extend the capabilities of SPSS through the use of various other scripting languages. In recent years much of the development of these capabilities has centered on the Python and R scripting languages. IBM themselves have added many features to SPSS that rely on these languages. In SPSS 23, many items you find in the SPSS menus are actually implemented using R or Python.

These extended capabilities can generally be used through either syntax or the SPSS menus. Users familiar with the Python or R languages can call these programs fairly directly from within SPSS syntax by including the other language within a block of PROGRAM - END PROGRAM syntax.

Of broader utility to end users, programmers can create SPSS-like syntax and SPSS-like dialog boxes that call programs written in these other languages. The familiarity of the SPSS interface makes it much easier for end users to get up to speed using algorithms based in other languages. This combination of SPSS syntax/dialog and an algorithm in another language is what SPSS calls an extension bundle.

To use an extension bundle, you must be working on a computer with the bundle installed. On the SSCC's Winstat servers and lab computers, this may require you to download the bundle from somewhere, to set up several environment variables, and then to install the bundles in your own file space (i.e. the U: drive). This is very simple, as long as you are aware you need to do something!

Many extension bundles are hosted at IBM's SPSS Community website. With SPSS 23, extension bundles hosted by SPSS can be downloaded, installed, and updated using the SPSS menus - however, you will first need to set up directories where they can be installed, and some Windows environment variables that point to those directories (see the next two sections).

For extension bundles not hosted by SPSS, and for older versions of SPSS, you will need to download them manually (usually through a web browser). If they are packaged as zip files, you will need to unzip them manually as well.

I'd suggest putting bundle downloads near where they will eventually be installed, perhaps in u:\spss\extensions (see the next section).

## Locations to Install Extension Bundles

On Winstat or a lab computer, create two (or three) folders on your U:\ drive where you can install your SPSS extensions. For example

U:\SPSS\extensions\bin, and

U:\SPSS\extensions\lib

These are for syntax and dialog extensions, respectively. If you are installing a bundle that uses R packages beyond base R, you will also need a folder where you can install these. (This should NOT be the same place you install R packages if you are an R user! On SSCC computers, SPSS uses a different version of R, currently 3.1.2 on Winstat.) If you are not sure, go ahead and set this up. For instance

U:\SPSS\extensions\rpackages

## Setting Up Environment Variables

On Winstat, set up two environment variables. These tell the operating system where to look for syntax and dialog extensions, in the folders you just created. Click Start - Control Panel - User Accounts

At the bottom left, click Change my environment variables.

The new environment variables will be

Variable name: Variable value:
SPSS_EXTENSIONS_PATH U:\SPSS\extensions\bin
SPSS_CDIALOGS_PATH U:\SPSS\extensions\lib

Click the New button, once for each variable, and fill in the variable name and variable value for each new variable.

For additional R packages, you need a third environment variable

Variable name: Variable value:
SPSS_RPACKAGES_PATH U:\SPSS\extensions\rpackages

Click OK a couple of times, and you are done.

Like creating folders, this only needs to be done once on Winstat. (If you are working on the lab computers, however, you may need to set up environment variables on each lab computer you use.)

## Install the Extension Bundle

To install or update bundles from the SPSS Community website, start up SPSS, then click Utilities - Extension Bundles - Download and Install Extension Bundles. Find your bundle(s) in the list, and click the selection box on the right. Click OK, then in the "Terms of Use" dialog box, change the selection to "I accept" and click OK.

To install a downloaded bundle, start up SPSS, then click Utilities - Extension Bundles - Install Local Extension Bundles, and navigate to where you saved the downloaded bundle (an *.spe file). Select the file and click Open.

You should get one or more dialog boxes to pop up, telling you the installation was a success.

We have encountered some "extension bundles" that are set up somewhat differently, for example, Hayes' PROCESS extension. If your bundle has an spd file, but no spe file, install it by clicking Utilities - Custom Dialogs - Install Custom Dialog, and navigate to the spd file.

If you are using an R extension, and it requires additional packages, they should be automatically downloaded as you install. If there is an error reported during this download, contact our Help Desk. If you are familiar with R and installing R packages, you might try starting up R 3.1.2, setting the .libPath to the SPSS folder you are using for R packages, and manually installing any packages mentioned (that's what we'll do!).

You should be able to use the extension right away. You may need to restart SPSS in order for syntax highlighting to work properly.

Last Revised: 7/29/2016