PRINTTO Procedure: Windows

Defines destinations for SAS procedure output and the SAS log.
Windows specifics: Valid values for file-specification; UNIT= option
See: PRINTTO Procedure in Base SAS Procedures Guide

Syntax

PROC PRINTTO <option(s)> ;

Required Argument

option(s)
LOG=file-specificationPRINT=file-specification
can be
  • a fileref defined in a FILENAME statement or function. To send SAS output or log directly to the printer, use a FILENAME statement or function with the PRINTER device-type keyword.
  • a quoted Windows pathname
  • an alphanumeric text string. The destination filename is file-specification.LOG or file-specification.LST and it is stored in the current directory.
  • a SAS or Windows environment variable
UNIT=nn
sends your SAS procedure output to the file FTnnF001.LST, where nn represents the UNIT= value, which can range from 1 to 99. The file is located in the SAS working directory.

Details

This version is a simplified version of the PRINTTO procedure syntax. For the complete syntax and its explanation, see the PRINTTO procedure in Base SAS Procedures Guide
The PRINTTO procedure defines destinations for SAS procedure output and for the SAS log.

Examples

Example 1: Redirecting SAS Log Output

The following statements redirect any SAS log entries that are generated after the RUN statement to an output file with a fileref of TEST, which is associated with the LPT1: device:
filename test printer 'lpt1:';
proc printto log=test;
run;
When these statements are issued, a dialog box is opened that informs you PROC PRINTTO is running. All SAS log entries are redirected to the TEST output file as specified. However, they are not printed on the LPT1: device until the output file is closed, either by redirecting the SAS log entries back to the default destination or to another file.
The following statements send any SAS log entries that are generated after the RUN statement to the external file associated with the fileref MYFILE:
filename myfile 'c:\mydir\mylog.log';
proc printto log=myfile;
run;

Example 2: Redirecting SAS Procedure Output

The following statements send any SAS procedure output to a file named MYPRINT.LST in your working directory (assuming that MYPRINT is not a previously defined fileref or environment variable):
proc printto print=myprint;
run;
The following statements send any SAS procedure output to the printer port, which is usually defined by the system as LPT1:
proc printto print='lpt1:';
run;

Example 3: Restoring the Output Destinations to the Default

The following statements (including a PROC PRINTTO statement with no options) redirect the SAS log and procedure output to the original default destinations:
proc printto;
run;