PRINTTO Procedure

PROC PRINTTO Statement

Defines destinations, other than ODS destinations, for SAS procedure output and for the SAS log.
Restrictions: To route SAS log and procedure output directly to a printer, you must use a FILENAME statement with the PROC PRINTTO statement. See Routing SAS Log or Procedure Output Directly to a Printer and Routing to a Printer.

The PRINTTO procedure does not define ODS destinations.

When SAS is started in objectserver mode, the PRINTTO procedure does not route log messages to the log specified by the ALTLOG= system option.

Tips: To reset the destination for the SAS log and procedure output to the default, use the PROC PRINTTO statement without options.

To route the SAS log and procedure output to the same file, specify the same file with both the LOG= and PRINT= options.

Routing to External Files

Routing to SAS Catalog Entries

Using Procedure Output as an Input File

Routing to a Printer

Syntax

PROC PRINTTO <option(s)>;

Summary of Optional Arguments

provides a description for a SAS log or procedure output stored in a SAS catalog entry.
routes the SAS log to a permanent external file or SAS catalog entry.
replaces the file instead of appending to it.
routes procedure output to a permanent external file or SAS catalog entry or printer.
routes the output to the file identified by the fileref.

Without Arguments

When no options are specified, the PROC PRINTTO statement does the following:
  • closes any files opened by a PROC PRINTTO statement
  • points both the SAS log and SAS procedure output to their default destinations.
Interaction:To close the appropriate file and to return only the SAS log or procedure output to its default destination, use LOG=LOG or PRINT=PRINT.

Optional Arguments

LABEL='description'
provides a description for a catalog entry that contains a SAS log or procedure output.
Range:1–256 characters
Interaction:Use the LABEL= option only when you specify a catalog entry as the value for the LOG= or the PRINT= option.
LOG=LOG | file-specification | SAS-catalog-entry
routes the SAS log to one of three locations:
LOG
routes the SAS log to its default destination.
file-specification
routes the SAS log to an external file. file-specification can be one of the following:
'external-file'
the name of an external file specified in quotation marks.
Restriction:external-file cannot be longer than 1024 characters.
log-filename
is an unquoted alphanumeric text string. SAS creates a log that uses log-filename.log as the log filename.
Operating environment:For more information about log-filename, see the documentation for your operating environment.
fileref
a fileref previously assigned to an external file.
SAS-catalog-entry
routes the SAS log to a SAS catalog entry. By default, libref is SASUSER, catalog is PROFILE, and type is LOG. Express SAS-catalog-entry in one of the following ways:
libref.catalog.entry<.LOG>
a SAS catalog entry stored in the SAS library and SAS catalog specified.
catalog.entry<.LOG>
a SAS catalog entry stored in the specified SAS catalog in the default SAS library SASUSER.
entry.LOG
a SAS catalog entry stored in the default SAS library and catalog: SASUSER.PROFILE.
fileref
a fileref previously assigned to a SAS catalog entry. Search for "FILENAME, CATALOG Access Method" in the SAS online documentation.
Default:LOG.
Interactions:The SAS log and procedure output cannot be routed to the same catalog entry at the same time.

The NEW option replaces the existing contents of a file with the new log. Otherwise, the new log is appended to the file.

To route the SAS log and procedure output to the same file, specify the same file with both the LOG= and PRINT= options.

When routing the log to a SAS catalog entry, you can use the LABEL option to provide a description for the entry in the catalog directory.

When the log is routed to a file other than the default log file and programs are submitted from multiple sources, the final SAS system messages that contain the real and CPU times are written to the default SAS log.

Tips:After routing the log to an external file or a catalog entry, you can specify LOG to route the SAS log back to its default destination.

When routing the SAS log, include a RUN statement in the PROC PRINTTO statement. If you omit the RUN statement, the first line of the following DATA or PROC step is not routed to the new file. (This occurs because a statement does not execute until a step boundary is crossed.)

NEW
clears any information that exists in a file and prepares the file to receive the SAS log or procedure output.
Default:If you omit NEW, the new information is appended to the existing file.
Interaction:If you specify both LOG= and PRINT=, NEW applies to both.
PRINT= PRINT | file-specification | SAS-catalog-entry
routes procedure output to one of three locations:
PRINT
routes procedure output to its default destination.
Tip:After routing it to an external file or a catalog entry, you can specify PRINT to route subsequent procedure output to its default destination.
file-specification
routes procedure output to an external file. file-specification can be one of the following:
'external-file'
the name of an external file specified in quotation marks.
Restriction:external-file cannot be longer than 1024 characters.
print-filename
is an unquoted alphanumeric text string. SAS creates a print file that uses print-filename as the print filename.
Operating Environment Information: For more information about using print-filename, see the documentation for your operating environment.
fileref
a fileref previously assigned to an external file.
Operating Environment Information: For additional information about file-specification for the PRINT option, see the documentation for your operating environment.
SAS-catalog-entry
routes procedure output to a SAS catalog entry. By default, libref is SASUSER, catalog is PROFILE, and type is OUTPUT. Express SAS-catalog-entry in one of the following ways:
libref.catalog.entry<.OUTPUT>
a SAS catalog entry stored in the SAS library and SAS catalog specified.
catalog.entry<.OUTPUT>
a SAS catalog entry stored in the specified SAS catalog in the default SAS library SASUSER.
entry.OUTPUT
a SAS catalog entry stored in the default SAS library and catalog: SASUSER.PROFILE.
fileref
a fileref previously assigned to a SAS catalog entry. Search for "FILENAME, CATALOG Access Method" in the SAS online documentation.
Alias:FILE=, NAME=
Default:PRINT
Requirement:To route procedure output to a file, you must open the LISTING destination. Specify ods listing; before you run the PRINTTO procedure.
Interactions:The procedure output and the SAS log cannot be routed to the same catalog entry at the same time.

The NEW option replaces the existing contents of a file with the new procedure output. If you omit NEW, the new output is appended to the file.

To route the SAS log and procedure output to the same file, specify the same file with both the LOG= and PRINT= options.

When routing procedure output to a SAS catalog entry, you can use the LABEL option to provide a description for the entry in the catalog directory.

UNIT=nn
routes the output to the file identified by the fileref FTnnF001, where nn is an integer between 1 and 99.
Range:1–99, integer only.
Tip:You can define this fileref yourself. However, some operating systems predefine certain filerefs in this form.