Previous Page | Next Page

The PRINTTO Procedure

PROC PRINTTO Statement


Restriction: To route SAS log and procedure output directly to a printer, you must use a FILENAME statement with the PROC PRINTTO statement. See Routing to a Printer.
Restriction: The PRINTTO procedure does not define ODS destinations.
Tip: To reset the destination for the SAS log and procedure output to the default, use the PROC PRINTTO statement without options.
Tip: To route the SAS log and procedure output to the same file, specify the same file with both the LOG= and PRINT= options.

PROC PRINTTO <option(s)>;
Task Option
provide a description for a SAS log or procedure output stored in a SAS catalog entry LABEL=
route the SAS log to a permanent external file or SAS catalog entry LOG=
combine the SAS log and procedure output into a single file LOG= and PRINT= with same destination
replace the file instead of appending to it NEW
route procedure output to a permanent external file or SAS catalog entry or printer. PRINT=


Without Options

When no options are specified, the PROC PRINTTO statement does the following:

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.
Featured in: Routing to External Files and Routing to SAS Catalog Entries

Options

LABEL='description'

provides a description for a catalog entry that contains a SAS log or procedure output.

Range: 1 to 256 characters
Interaction: Use the LABEL= option only when you specify a catalog entry as the value for the LOG= or the PRINT= option.
Featured in: Routing to SAS Catalog Entries
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 Information:   For more information about log-filename, see the documentation for your operating environment.  [cautionend]

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.
Interaction: The SAS log and procedure output cannot be routed to the same catalog entry at the same time.
Interaction: The NEW option replaces the existing contents of a file with the new log. Otherwise, the new log is appended to the file.
Interaction: To route the SAS log and procedure output to the same file, specify the same file with both the LOG= and PRINT= options.
Interaction: 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.
Interaction: 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.
Tip: 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.
Tip: 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.)
Featured in: Routing to External Files, Routing to SAS Catalog Entries, and Using Procedure Output as an Input File
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.
Featured in: Routing to External Files, Routing to SAS Catalog Entries, and Using Procedure Output as an Input File
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.  [cautionend]

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.  [cautionend]

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.

Aliases: FILE=, NAME=
Default: PRINT
Interaction: The procedure output and the SAS log cannot be routed to the same catalog entry at the same time.
Interaction: 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.
Interaction: To route the SAS log and procedure output to the same file, specify the same file with both the LOG= and PRINT= options.
Interaction: 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.
Featured in: Using Procedure Output as an Input File
UNIT=nn

routes the output to the file identified by the fileref FTnnF001, where nn is an integer between 1 and 99.

Range: 1 to 99, integer only.
Tip: You can define this fileref yourself; however, some operating systems predefine certain filerefs in this form.

Previous Page | Next Page | Top of Page