What is "syntax" in SPSS?

From PsychWiki - A Collaborative Psychology Wiki

Jump to: navigation, search

What is "syntax" in SPSS?

  • When you point-and-click in the Data Editor for SPSS (to calculate a mean, or outlier, or correlation, or whatever) SPSS is calculating the statistical formulas for those tests. SPSS is basically a big calculator that can perform many different calculations. When you point-and-click in the Data Editor for SPSS, you are telling SPSS how to perform those calculations.
  • Another way to tell SPSS to perform those same operations is to use programming language. In the syntax window, you can type programming language, then hit the "run" button, and SPSS will perform the calculations. This process is analogous to how a website designer writes computer code to design a website, but you don't see the code, only the website design. Similarly, the point-and-click functionality in SPSS is analogues to the website design you see, and the syntax functionality in SPSS is analogues to the background computer code that you typically don't see.
  • You can use syntax for any point-and-click command. For example, for every command in SPSS, instead of clicking “OK” as the last step, you can click “PASTE” instead as the last step, and it will display the syntax.


Why use syntax?

  • The point-and-click interface is very easy to use. You don't need to learn the syntax programming language which can sometimes get overwhelming and difficult to understand. However, there are some advantages to syntax. For one, you can perform multiple operations easier than with the point-and-click interface. For example, if you want to reverse code multiple items, you have to repeat the same steps over and over in the point-and-click interface. Syntax, however, makes that repetition less time-consuming.
  • Another way to use syntax is to keep a record of your statistical analyses because the syntax indicates not only which statistical analyses was performed, but it also provides a record of how you performed those statistical analyses and which options you chose to use. The Output window provides that record by displaying the syntax for every analyses that is conducted.





◄ Back to Research Tools mainpage