See: PRINTTO Procedure in the documentation for your operating environment.
PROC PRINTTO < option(s) >;
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.
Restriction: To route SAS log and procedure output directly to a printer, you must use a FILENAME statement with the PROC PRINTTO statement. See Example 4 on page 801.
PROC PRINTTO < option(s) >;
To do this | Use this 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= |
Using a PROC PRINTTO statement with no options
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.
Featured in: Example 1 on page 792 and Example 2 on page 795
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: Example 2 on page 795
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.
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 using 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 data library and SAS catalog specified.
catalog.entry <.LOG>
a SAS catalog entry stored in the specified SAS catalog in the default SAS data 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.
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.)
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.
Featured in: Example 1 on page 792, Example 2 on page 795, and Example 3 on page 798
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: Example 1 on page 792, Example 2 on page 795, and Example 3 on page 798
PRINT= PRINT file-specification SAS-catalog-entry
routes procedure output to one of three locations:
routes procedure output to its default destination. 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. It is one of the following:
external-file
the name of an external file specified in quotation marks.
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: See your operating environment documentation for additional information about file-specification for the PRINT option.
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 data library and SAS catalog specified.
catalog.entry <.OUTPUT>
a SAS catalog entry stored in the specified SAS catalog in the default SAS data 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: Example 3 on page 798
UNIT= nn
routes the output to the file identified by the fileref FT nn F001, 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.