Most of us start working with SPSS from its point-click menu. Doing so without pasting and saving all syntax may seem obvious at first but often turns out to be a pitfall. Using SPSS syntax may seem a bit difficult at first but often turns out to save tons of time and effort in the end. This tutorial explains why.
1. Syntax is Ideal Project Documentation
You delivered a report to your client. After a week (or a month or even a year) he calls you and complains that the results just can't be correct. Suppose you did all your data editing and analyses from syntax (and saved it). Now you can easily walk through the exact steps you took in the exact correct order and inspect intermediate results extra carefully. If you're really confident about the quality of your work and the data you can even hand over your syntax to your client. The bottom line is that you can retrieve exactly what you did.
2. Syntax can be Corrected
Suppose you did a lot of data editing and analyses and you discover some mistake. Perhaps you suddenly realize you forgot to specify some missing values or remove some weird observations from your data. Or maybe your client changes his mind and decides he'd like to see all results for male and female respondents separately. Such cases can often be solved by just adding or modifying a few lines in your syntax and simply rerunning the whole bunch.
3. Syntax can be Recycled
If you're working on a project that has similarities to other projects, chances are you can copy-paste-edit syntax from one to the other. Especially for yearly or quarterly surveys this can be a huge time saver and may enhance the consistency and quality of your work as well. You may also develop your own routines that you'll run over (many) different data sources.
An entirely different example of 'recyclable' syntax are SPSS help forums. Here, experienced users will often happily write some syntax for you if you describe clearly what you'd like to accomplish.
4. Syntax Gets Things Done Fast
Larger or more complex projects may require vast amounts of syntax. Such syntax often has a clear structure. For instance, some task(s) should be repeated a little differently for each variable(s). In such cases, copying-pasting-editing syntax is way faster and more reliable than wasting a day clicking through menu options. However, the real way to tackle such situations is having Python generate and run the syntax for you.
5. Typing Syntax Saves Time
A lot of tasks are accomplished fastest by just typing their syntax in a short form (see SPSS Data Analysis - Basic Roadmap). This goes especially for many dictionary modifications such as value labels. However, this doesn't hold for all commands and may require some practice. Nevertheless, it is by far the preferred way of working for experienced users.

6. Syntax has More Options
This holds especially for transformations such as DO REPEAT, VECTOR and LOOP. Interestingly, these commands are very easy to learn and typically save substantial time and effort while reducing typos. Apart from transformations, some procedures are also not available from the menu, for example
MANOVA
.
THIS TUTORIAL HAS 7 COMMENTS:
By David Marso on November 10th, 2013
Perhaps add MACROS (DEFINE !ENDDEFINE) into the mix as an alternative to Copy Paste? The use of macro libraries for common tasks to be used across projects is possibly another tutorial. I would be happy to collaborate. Alternatively INCLUDE or INSERT
Also: The Paste button tends to throw out a lot of verbose stuff which are default arguments for the various sub-commands. When I use Paste, the first thing I do is trim the resulting code (OK, I just visited the Write Shorter Syntax link - have a few disagreements with that.. stay tuned-).
By admin on November 11th, 2013
Dear David, thx for your feedback!
However, I really feel MACROS are completely obsolete since Python was introduced since version 14. I think large macros for rare, specialized statistical procedures had better be rewritten as Custom Dialogs if average SPSS users are supposed to find them accessible.
I agree that INSERT is an essential part of the toolkit. I'll soon write something about it but it's more about how to use syntax than why to use syntax so it doesn't really belong in this tutorial.
Looking forward to your feedback on shorter syntax!
By Linda Martell on July 15th, 2015
Good
By shimanto roy on September 9th, 2018
I want to string variable into a separate variable with yes or no coding. Example if variable =136 I want 1 for one variable, 3 for one variable, 6 for one variable.
By Ruben Geert van den Berg on September 10th, 2018
Hi Shimanto!
Try the syntax below.
*Create test data.
data list free/mystring.
begin data
0 0 0 0 0 0 0 0 0 0
end data.
compute mystring = trunc(rv.uniform(0,1000000)).
formats mystring(n6).
alter type mystring(a6).
*Actual solution starts here.
string s1 to s6(a1).
do repeat #var = s1 to s6 / #pos = 1 to 6.
compute #var = char.substr(mystring,#pos,1).
end repeat.
execute.