Here you can find some scripts I have written so far, ready to download.
Each script has a detailed description of its functionalities and its
requirements.
Another good place to check out for dowloading scripts is the
SPSS Script eXchange section, available in
the SPSS web site.
If you want to add a your own script to this page, so that anyone can use it, please fill this form.
By clicking on the send button, data will be sent to me via email.
This script is also available in the SPSS Script eXchange section.
This script replaces words contained in the title, footnotes, and label cells
of pivot tables. It provides a dialog box in which the user specifies the
word to search for together with the word that replaces it.
It is possible to replace more than one word at a time, by specifying in the
Dialog box a list of word replacements.
That list can be saved into a file, which can be loaded later for reuse.
A check box on the form allows the user to choose if the search for the word to
be replaced is case sensitive (distinguishing uppercase/lowercase letters or not).
The user can also choose what part of tables to replace (title, footnotes, label
cells).
Finally, it is possible to decide if the replacement will affect all pivot tables
or only the selected pivot tables.
The script replaces only the words contained in the list: even if only one word
needs to be replaced, it must be added to the list.
An output window needs to be opened. The script acts only onto the designed output window.
Replaces words contained in either pivot tables' title, label cells and footnotes of the designated output document.
Version 7.5 or higher
This script executes the DOS command (that could also be a batch file) given as parameter
in the SCRIPT command, and waits until the DOS command finishes its execution: the script
ends when the launched DOS command terminates.
The path where the DOS command will be executed is the active path.
The script must be invoked from syntax with the SCRIPT command, giving for parameter the DOS command to execute:
SCRIPT "DOS.Sbs" ("<DosCommand>").replacing <DosCommand> with the DOS command to execute.
Run a DOS command waiting for the end of its execution.
The DOS command could be also a batch file.
Version 8.0 or higher
There are syncronization problems when scripts are called from syntax: they don't execute
where they are supposed to do. Scripts are executed after SPSS has finished running all
the syntax, and not at the point where they are called in the syntax.
This script tries to solve this problem, by reading the syntax in the active syntax window
and sending it to SPSS for execution. When it encounters a SCRIPT command, it is
immediately executed.
The organization of the entire job is given to this script, not to SPSS, therefore the
execution of a syntax containing script calls need to be invoked by launching this script.
INCLUDE commands are also handled by the script by loading the syntax file to include,
and executing it in the same way of the syntax in the syntax window. When the include
syntax file terminates, the commands following the INCLUDE command are executed. Nested
include files are supported, and the allowed number of nesting levels depends from the
script's available free memory.
In this way, SCRIPT commands also found in an included syntax file, are handled and
immediately executed.
This script acts as an interpreter: it reads every syntax line, and when either the SCRIPT
or INCLUDE command has been recognized, it performs the appropriate action.
Every not recognized command is sent to the SPSS processor.
A syntax window needs to be opened. The script executes only the code into the designated syntax window.
Parameters passed with the SCRIPT command will be sent to the script to execute, but the script invoked by this command can read the parameters by using the Command$ function, instead of the objSpssApp.ScriptParameter() method as usual.
Either SCRIPT and INCLUDE commands, when placed in a macro definition (that is, within DEFINE - !ENDDEFINE) are ignored, and they won't be executed. Other commands in a macro definition will be executed as usual.
Allows syncronization between scripts and syntax: now a script called with the SCRIPT command is immediately executed.
Version 7.5 or higher (tested only with SPSS version 10.0.7)
This script copies variable and value labels from one variable to another variable.
It must be called within a syntax. The passed parameters specify the source and destination
variables.
It takes advantage of the SyntaxScript script, so that it can be called in a syntax and
executed immediately, by making this script really useful.
Both source and destination variables must exist.
Variable and/or value labes for destination variable are in any case replaced with the source variable corresponding labels, even if these are empty.
The script must be invoked from syntax with the SCRIPT command, by giving to it the following parameters:SCRIPT "CopyLabels.Sbs" ("<source var name>,<dest var name>,VARIABLE,VALUE").where:<source var name>: is the name of variable from which copy labels; variable must existVARIABLE and VALUE parameters are optional, but at least one of them must be specified.
<dest var name> : the name of variable to which copy labels; variable must exist
VARIABLE : tells the script to copy the variable label
VALUE : tells the script to copy value labels
Parameters are comma or space separated.
Copies labels from one variable to another.
Version 7.5 or higher (tested only with SPSS version 10.0.7)
This simple script extracts both value and variable labels for all variables in the active
datafile and creates a new syntax window containing the VARIABLE LABEL and VALUE LABELS
SPSS commands for the extracted labels.
The created syntax can be executed to assign the variable and/or value labels of the active
datafile to another datafile with the same variable names.
none
Creates a new syntax window full of the SPSS commands used to assign variable and/or value labels to the active datafile.
If the active datafile is empty or it doesn't contain any variable and/or value label, an empty syntax window will be created.
In any case, every generated VARIABLE LABEL/VALUE LABELS command in the created syntax window assigns labels for only one variable, even if in datafile there are variables with labels in common.
In this case the generated syntax will contain a VARIABLE LABEL/VALUE LABELS command for every one of these variables.
Version 7.5 or higher (tested only with SPSS version 10.0.7)