SPSS tutorials website header logo SPSS TUTORIALS BASICS ANOVA REGRESSION FACTOR CORRELATION

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.

Data View SPSS Practice File Adratings.sav

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.

Transformations Pending in Data View After Running Transformation But Not EXECUTE

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:

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:

Command Syntax Reference on COMPUTE - An SPSS Tranformation 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

Command Syntax Reference on FREQUENCIES - An SPSS Procedure 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.

Command Syntax Reference on RANK - An SPSS Procedure RANK transforms your data but it is a procedure, not a transformation.

So When To Use EXECUTE?

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

*Wrong way to compute total and delete input 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

*Wrong way to compute ad1 for previous case, then add 10 to original ad1.

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

*Wrong way to delete first 10 cases.

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!

Tell us what you think!

*Required field. Your comment will show up after approval from a moderator.