SPSS Scripts — Home
Scripting with Sax or WinWrap Basic (used to be) Heavy Duty Stuff!
NB: With the advent of Python, Sax (WinWrap) Basic scripting is now obsolete. I have not written SAX Basic code since SPSS 15.
Introduction
Sax Basic scripting were added to SPSS for Windows version of SPSS. If you have never used Visual Basic (VB) or Visual Basic for Applications (VBA), you will find the learning curve to be pretty steep. SPSS uses Sax Basic developed by Sax Software. By adding Sax's Type Library to your favourite VB development environment (for instance, VB6, Excel or Access) you may develop your SPSS scripts using those development environments.
Scripts allow the user to do things which would not be possible using syntax, for instance formatting an IGRAPH or having error handlers. Whenever possible, I prefer to use syntax instead of scripts. As my knowledge of syntax increased, I discovered ways to do things which I previously thought only scripting could do, one such example is exporting or creating a variable which contains the value labels of another variable.
Scripts can be called from syntax and vice versa. However a major problem is that a script called from anywhere in a syntax could be executed after the syntax file has finished! The same problem exists when a script calls a syntax, that syntax could only be executed once the script has finished.
Starting with version 14, Python scripts run synchronously with syntax files. The asynchronous problem is thus resolved. See Self adjusting code for examples.
Note that Scripting is not available in SPSS for Mac or Linux.
Show me data and I will show you data errors! -
VB Programs
spssrun.exe. This program has been written by Alexis-Michel Mugabushaka of the University of Kassel, Germany. The program is similar to SPSS Production's facility. You feed the program with a list of syntax files or a file containing a list of syntax files. The program runs each syntax one by one and create a separate output file for each of the syntax file and having the same name as the syntax file. See also Break Output File into Smaller Pieces.sbs
ViewSav ViewSav is a Real-Time Codebook for SPSS data files. It has been written by Karel Asselberghs from the Sociology Department, University of Amsterdam. He has also 2 other SPSS utilities:CRC32SAV and LISTSAV. The first one computes checksums for separate parts of a SPSS data file: file header, dictionnary and data. This enables you to check if these areas of 2 sav files are identical. The second one list variables and variable labels of a SPSS data file. (source code included).
...