SPSS EXECUTE – What and Why?
EXECUTE runs pending transformations.
However, many SPSS users don't have a clue what that means. More importantly, when should you (not) run EXECUTE? And when do you really need it?
Let's dive in. We'll use adratings.sav throughout, part of which is shown below.
SPSS “Transformations Pending”
As you probably figured out, our data hold 18 respondents who rated 3 different advertisements. Now let's say we need to compute a corrected version of ad1 which we'll name cad1 by adding 10 points to each score.
The easy way is a simple COMPUTE command like
compute cad1 = ad1 + 10.
If you run just this syntax, your data view will look like below.
So what's “transformations pending” in the status bar? And where's my corrected scores? I told SPSS to compute them and it hasn't done so! F!@#$%g SPSS!
However, just running
execute.
successfully completes our transformation.
So Why Did we Need EXECUTE?
Basically everything we do in SPSS is done by commands. You may not see those if you work directly from the menu -a recipe for disaster as explained in SPSS Syntax - Six Reasons you Should Use it.
But anyway, SPSS commands come in 3 basic types:
- procedures are commands that must inspect all cases. Some examples are FREQUENCIES, DESCRIPTIVES and SORT CASES plus all charts and statistical tests. These commands require SPSS to “go through” all cases straight away.
- transformations are commands that will inspect all cases but this only happens when really needed. Well known transformations are COMPUTE, RECODE, IF and SELECT IF.
- other commands that don't inspect any cases. Examples are FILTER, VARIABLE LABELS and ADD VALUE LABELS.
If you want to know if a command is a procedure, transformation or other, consult Overview All SPSS Commands.Yes, I know. I need to update it. Any volunteer for that?
Now imagine that you're SPSS -it isn't hard to do. You have data with 100,000 cases open. If somebody asks you to COMPUTE something, you must go through all 100,000 cases. Quite a job!
Then, if the user asks for FREQUENCIES, you must go through all 100,000 cases again. So in order to save computing time (and electricity)
SPSS prefers to go through all cases just once
and do the COMPUTE and FREQUENCIES in one go. So that's why it won't immediately execute some commands -which are known as transformation commands.
SPSS Transformation Commands
Now if we consult the command syntax reference on COMPUTE, we see the following:
COMPUTE is a Transformation
The phrase “it is stored, pending” indicates that COMPUTE is a transformation. This means that we need to EXECUTE it if we want to inspect the result in the data editor before proceeding.
SPSS Procedures
If we look up FREQUENCIES, the fine manual tells us that
FREQUENCIES is a Procedure
and a command that “reads the active dataset” is a procedure.
This means that
running EXECUTE right before FREQUENCIES is pointless
and merely slows down SPSS.
The same goes for EXECUTE right after VARIABLE LABELS or RENAME VARIABLES: these are not transformations but take place immediately so there aren't any pending transformations to execute.
Importantly, some commands that transform your data are technically procedures, not transformations. Examples are ALTER TYPE, AGGREGATE and RANK.
RANK transforms your data but it is a procedure, not a transformation.
So When To Use EXECUTE?
- Use EXECUTE if you have transformations pending and you want to visually inspect results before doing anything else.
- In rare cases, you need EXECUTE in order for your syntax to run correctly.
So when do you really need EXECUTE? I'm familiar with 3 scenarios so I'll present them below. Again, all examples use adratings.sav.
1. EXECUTE Before DELETE VARIABLES
compute total = sum(ad1 to ad3).
delete variables ad1 to ad3.
*Right way to compute total and delete input variables.
compute total = sum(ad1 to ad3).
execute.
delete variables ad1 to ad3.
2. EXECUTE Before LAG Function
compute prev_ad1 = lag(ad1).
compute ad1 = ad1 + 10.
execute.
*Right way to compute ad1 for previous case, then add 10 to original ad1.
compute prev_ad1 = lag(ad1).
execute.
compute ad1 = ad1 + 10.
execute.
3. EXECUTE After Using $Casenum
compute casenum = $casenum.
select if casenum > 10.
execute.
*Right way to delete first 10 cases.
compute casenum = $casenum.
execute.
select if casenum > 10.
execute.
I guess that's about it. Hope you liked it. Do you have any other examples in which you really need EXECUTE? Please drop me a comment below and let me know.
Thanks for reading!
SPSS Extension Bundles
Summary
SPSS Extension Bundles are extra program features that you can add to SPSS. Like so, you can add data editing routines, statistical procedures or other features that the program does not include by default. Most extensions are freely downloadable. You can also write and distribute your own Extension Bundles but doing so is reasonably challenging.
SPSS Extension Bundles - Introduction
Different SPSS users have different needs with regard to the program. Although SPSS includes a lot of handy routines by default, including all features desired by all users just isn't doable. The solution to this problem is that SPSS enables users to create and distribute their own additional program features in the form of SPSS Extension Bundles.
We'll later discuss precisely what Extension Bundles are from a technical point of view. First, we'll show how you can install and use Extension Bundles.
SPSS Extension Bundles - Where to Get Them?
Most of the tools on our website are currently in the form of SPSS Custom Dialogs but we'll gradually convert the most important ones into Extension Bundles during the remainder of 2015. A vast collection of freely downloadable extensions are available from IBM SPSS.
SPSS Extension Bundles - How to Install Them?
The most recent SPSS versions allow you to download and install extensions from within SPSS. However, we personally prefer downloading our extensions manually first. Like so, we can include them in our project folder and make sure they get backed up with the other project files. If the project ever needs to be replicated -perhaps on a different computer- we can be confident that the necessary extensions will be readily available.
Installing extensions just couldn't be easier: select
and navigate to the bundle you'd like to install. Its file name ends in “.spe”, which is short for SPSS Extension.
SPSS Extension Bundle Installation
SPSS Extension Bundles - Dependencies
Many extensions require either the SPSS Python Essentials or the R plugin. If you're not sure whether these are needed have been installed, just try and install the extension. SPSS will then check for you whether all prerequisites are present and -if not- draw your attention to any missing components as shown below.
SPSS Extension Bundles - How to Use Them?
Good question. However, there's no general answer to it; just as the purposes of extensions differ widely, so do their interfaces. But then again, many extensions come with a dialog window. If well designed, the dialog window will tell you how to use it, as shown below.
If that's insufficient, try clicking the button (it may be greyed out if the author didn't add a help file) or Google for information. If everything else fails, try and contact the author: select
.
In the window that pops up, each installed extension has a link which will open some general information on the extension, including its author and -possibly- a URL. It also tells you where in SPSS’ menu you'll find the extension interface.
SPSS Extension Bundles - What Are They?
Technically, extensions are archive files: ‘zipped’ folders. If you're curious what's inside, their contents can be extracted with 7 Zip and a myriad of other programs.
Typical Contents of Extension Bundle After Unzipping
Part of many extensions is an .xml file which defines a new SPSS syntax command. After installing the extension, it will function no differently from SPSS commands that are included in the program by default such as FREQUENCIES or COMPUTE. In fact, you may even redefine what these commands do with an extension. Not recommended.
Further, extensions often contain an SPSS custom dialog, recognizable by its file name ending with “.spd”. Finally, a Python module (.py file) may be present containing the actual program powering the extension.
SPSS TUTORIALS