Overview (OUTPUT CLOSE 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 CLOSE command closes one or many open output documents.

Basic Specification

The only specification for OUTPUT CLOSE is the command name followed by the name(s) of the open output document(s), an asterisk (*), or the keyword ALL. The NAME keyword is optional, but if it is used it must be followed by an equals sign.

Operations

  • If names are provided, the specified output documents are closed and the associations with the names are broken.
  • If an asterisk (*) is specified, the designated output document is closed. If the designated output document has a name, the association with that name is broken.
  • If ALL is specified, all open output documents are closed and all associations of names with output documents are broken.
  • Output documents are not saved automatically when they are closed. Use OUTPUT SAVE to save the contents of an output document.
  • OUTPUT CLOSE is ignored if you specify a nonexistent document.

Example

GET FILE='/examples/data/Males.sav'.
FREQUENCIES VARIABLES=ALL.
OUTPUT SAVE OUTFILE='/examples/output/Males.spv'.
OUTPUT CLOSE *. 

GET FILE='/examples/data/Females.sav'.
FREQUENCIES VARIABLES=ALL.
  • FREQUENCIES produces summary statistics for each variable. Procedure output is added to the designated output document (one is created automatically if no output document is currently open).
  • OUTPUT SAVE writes contents of the designated output document to the file /examples/output/Males.spv.
  • OUTPUT CLOSE closes the designated output document.
  • Output from the second FREQUENCIES command is written to a new output document, which was created automatically when the previous designated output document was closed. If OUTPUT CLOSE had not been issued, output for females would have been directed to the output document that contained summaries for males.