Overview (OUTPUT ACTIVATE command)
The OUTPUT
commands
(OUTPUT NEW
, OUTPUT
NAME
, OUTPUT ACTIVATE
, OUTPUT OPEN
, OUTPUT SAVE
, OUTPUT CLOSE
) provide the ability to programmatically
manage one or many output documents. These functions allow you to:
- Save an output document through syntax.
- Programmatically partition output into separate output documents (for example, results for males in one output document and results for females in a separate one).
- Work with multiple open output documents in a given session, selectively appending new results to the appropriate document.
The OUTPUT ACTIVATE
command
activates an open output document, making it the designated output
document. Subsequent procedure output is directed to this output document
until the document is closed or another output document is created,
opened, or activated.
Basic Specification
The basic specification for OUTPUT ACTIVATE
is the command name followed by the name
of an open output document. This is the name assigned by a previous OUTPUT NAME
, OUTPUT
OPEN
, OUTPUT NEW
command,
or automatically assigned when the document is created or opened in
the current session; it is not the file name associated with a saved
output document. In the Viewer window title bar, the name is enclosed
in square brackets. The NAME
keyword
is optional, but if it is used it must be followed by an equals sign.
Operations
- The window containing the activated document becomes the designated output window in the user interface.
- An error occurs, but processing continues, if the named output document does not exist. Output continues to be directed to the last designated output document.
Example
GET FILE='/examples/data/SurveyData.sav'.
TEMPORARY.
SELECT IF (Sex='Male').
FREQUENCIES VARIABLES=ALL.
OUTPUT NAME males.
TEMPORARY.
SELECT IF (Sex='Female').
OUTPUT NEW NAME=females.
FREQUENCIES VARIABLES=ALL.
GET FILE='/examples/data/Preference.sav'.
TEMPORARY.
SELECT IF (Sex='Female').
DESCRIPTIVES VARIABLES=product1 product2 product3.
TEMPORARY.
SELECT IF (Sex='Male').
OUTPUT ACTIVATE males.
DESCRIPTIVES VARIABLES=product1 product2 product3.
OUTPUT SAVE NAME=males OUTFILE='/examples/output/Males.spv'.
OUTPUT SAVE NAME=females OUTFILE='/examples/output/Females.spv'.
- The first
GET
command loads survey data for males and females. -
FREQUENCIES
output for male respondents is written to the designated output document. TheOUTPUT NAME
command is used to assign the name males to the designated output document. -
FREQUENCIES
output for females is written to a new output document named females. - The second
GET
command loads preferences data for males and females. - After the second
GET
command, the output document named females is still the designated output document. Descriptive statistics for females are appended to this output document. -
OUTPUT ACTIVATE males
activates the output document named males. Descriptive statistics for males are appended to this output document. - The two open output documents are saved to separate files. Because the operation of saving an output document does not close it, both documents remain open. The output document named males remains the designated output document.