Select Page

The PROC PRINTTO command in SAS is used to route log and procedure output to files or printers. Defines destinations for SAS process output and the SAS log that are not ODS destinations. ODS destinations are not defined by the PRINTTO method. To restore the default destination for SAS log and procedure output, use the PROC PRINTTO command without any arguments. Let’s have a look at how it works:

  1. Routing to External Files:

 to store the output in an external file, use the PROC PRINTTO line to specify the external file or a fileref.

Use the procedure’s LOG= option to indicate the location and file name for the log output.

  • proc printto log=’path_to_log_file.log’; o run;
  • o The SAS log will be sent to the provided external file.
  • Routing to SAS Catalogue Entries:

The output can also be routed to an SAS catalogue entry.

The library is SASUSER by default, the catalogue is PROFILE, and the type is LOG.

State it as follows:

 proc printto log=SASUSER.PROFILE.MYLOG; o run; o The SAS log will be sent to a catalogue entry named MYLOG.

  • Using Procedure Output as an Input File:
    • You can use procedure output as an input file for further processing.
    • For example, if you want to use the output from PROC PRINT as input for another procedure:
    • proc print data=my_data;
    • run;
    •  
    • /* Use my_data as input for another procedure */
  • Routing to a Printer:
    • To route SAS log and procedure output directly to a printer, use a FILENAME statement with PROC PRINTTO.
    • For example:
    • filename myprinter ‘printer_name’;
    • proc printto print=myprinter;
    • run;
    • This will send the output directly to the specified printer.

Remember that these examples show how to use PROC PRINTTO to control where your SAS output travels. Change them to meet your personal requirements!