By Ruben Geert van den Berg on April 27, 2013 under SPSS Syntax Beginners Tutorials.

SPSS Syntax Shortening

Summary

Experienced SPSS users often just type in their syntax and get things done amazingly fast like that. The trick is that they write much shorter code than SPSS generates when the point-click menu is used. Identical results can thus be achieved with much less effort. This tutorial explains how.

How to Save Time and Effort

Say you'd like to see just some basic descriptive statistics for some variables. The syntax generated by clicking Paste in the menu may be
DESCRIPTIVES VARIABLES=v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 v17 v18 v19 v20 v21 v22 v23 v24
/STATISTICS=MEAN STDDEV MIN MAX.
So how could typing code manually ever be faster than pasting it? We'll walk you through some potential time savers below.

1. Use TO and ALL

DESCRIPTIVES VARIABLES=v1 TO v24
/STATISTICS=MEAN STDDEV MIN MAX.

2. Don't Use Upper Case

descriptives variables=v1 to v24
/statistics=mean stddev min max.

3. Leave Out Indentation and Line Breaks

descriptives variables=v1 to v24/statistics=mean stddev min max.

4. Leave Out Default Options.

descriptives variables=v1 to v24.

5. Leave Out Optional Keywords

descriptives v1 to v24.

6. Abbreviate Commands

des v1 to v24.

Conclusion

At this point, you probably see how hand writing short syntax is often the fastest way for getting things done in SPSS. However, in order to maximally benefit from this, you'll have to learn what can (not) be omitted or abbreviated. This is a trial and error learning process that requires some practice but really pays off in the end. Once you get in the habit, you'll wish you'd done so sooner.

Comment on this Tutorial

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

This Tutorial has One Comment: