Search code examples
transformationspssexecution

Which kinds of SPSS commands require EXECUTE and which do not?


SPSS documentation indicates that EXECUTE is "designed for use" with transformation commands and

facilities such as ADD FILES, MATCH FILES, UPDATE, PRINT, and WRITE, which do not read data and are not executed unless followed by a data-reading procedure.

Is there a way of determining at a high level which commands are not "transformation" commands or* are commands that do not read data without investigating every single command before use to determine whether or not the command needs to be executed?

*I'm assuming it's "or" here and not "and"?


Solution

  • Actually, no command actually "needs" and EXECUTE command. If every transformation is executed immediately, and separately, it can cause longer processing time than when you run a list of transformations simultaneously.

    You only need to EXECUTE when you want to see, or use, the results of the transformations. That's why if you run any analysis (eg. frequencies) on your data, transformations will run automatically.

    In principle, you could run a long syntax without a single EXECUTE command - a save command at the end also runs pending transformations automatically (as does sort cases).

    You should be aware though that there are (rare) situations where you need to run transformations before you move on to your next command. For example, if you use the write command to create a new syntax and then insert that syntax - you have to EXECUTE first or the new syntax will still be empty. Another example is if you use add files on a dataset that has pending transformations, you will be getting the pre-transformed data. So you should use EXECUTE before adding the files. There are also more complex scenarios e.g. transforming results of a lag function, but these are rare.

    So to summarize: No command NEEDS to be executed. Use EXECUTE only when you need to see the results or use them in specific operations that require it (and then only if you didn't use other commands like save, sort or analyses that automatically execute anyway).