Chapter Contents

Previous

Next
SAS Companion for the OS/390 Environment

Directing Output to a Printer

You can direct SAS output to a printer with the PRINTTO procedure, the PRINT command or PMENU selection combined with the FORM subsystem, or with the PRTFILE command combined with the PRINT command or menu selection.


Using the PRINTTO Procedure

You can use the FILENAME statement or FILENAME function in conjunction with the PRINTTO procedure to route your output directly to a printer. Use the SYSOUT= option in the FILENAME statement or function to direct your output to the system printer. Then specify the fileref with the PRINT= or LOG= option in the PROC PRINTTO statement. The following example establishes a fileref and uses it in the PROC PRINTTO statement to redirect the procedure output:

filename output sysout=a;
proc printto print=output;

Usually, SYSOUT=A specifies that the destination is a printer; however, this is determined by the data center personnel at your site.

Example

Follow these steps to print a file with the PRINTTO procedure:

  1. Identify a print destination:
    filename myprint dest=dest99 sysout=a hold;

  2. Identify the print destination to SAS:
    proc printto log=myprint;

  3. Remove the print destination:
    proc printto log=log;


Using the PRINT Command and the FORM Subsystem

Use the PRINT command or menu selection to direct the contents of a window to your default printer. This is the easiest method of printing output. For example, issue the PRINT command from the command line of your OUTPUT window to send the contents of that window to your default printer.

The default printer--as well as other aspects of your output such as printer margins, printer control language, and font control information--are controlled by the FORM subsystem. The FORM subsystem consists of six frames that are described in detail in SAS Language Reference: Dictionary and in Host-Specific Windows of the FORM Subsystem. You use these frames to define a form for each printer that is available to you at your site. You can also define multiple forms for the same printer. (See Adding a Form.) Your local SAS Support Consultant can give you information about your default form and about any other forms that have been defined at your site.

Specifying a Form

To direct the contents of a window to a printer that is not your default printer, you can use the FORM= option with the PRINT command. Use this option to specify a form that has been defined for a different printer. For example, to copy output to a printer destination that is described in a form named MYOUTPUT, you would enter the following command-line command:

print form=myoutput

Modifying Your Default Form

To change the default destination printer and to customize other features of the output that the PRINT command generates, you can modify the default form that the FORM subsystem uses. To modify your default form, do the following:

  1. Enter fsforms default from the command line to display your default form. If your SASUSER.PROFILE catalog contains a form named DEFAULT, then that form is displayed. If you do not have a form named DEFAULT, then the Printer Selection frame is displayed.

  2. Select a printer from the Printer Selection frame. When you select a printer, SAS copies the default form for that printer into your SASUSER.PROFILE catalog.

    Note:   Printer information is site-specific; see your system administrator if you need help with selecting a printer.  [cautionend]

  3. Make other changes to the default form, if desired, by changing the information in the other frames of the FORM subsystem. Issue the NEXTSCR command to scroll to the next FORM frame, and issue the PREVSCR command to scroll to the previous frame. Two of these frames, the Print File Parameters frames, are used to specify host-specific printer information; they are described in Host-Specific Windows of the FORM Subsystem. The other frames are described in SAS Language Reference: Dictionary.

  4. Enter the END command to save your changes.


Adding a Form

You can also add additional forms to the FORM subsystem. These forms can then be used with the PRINT command, as described in Specifying a Form, and they can be modified in the same manner as described in Modifying Your Default Form. For example, to create a form named MYOUTPUT, do the following:

  1. Enter fsforms myoutput from the command line.

  2. Select a printer from the Printer Selection frame.

  3. Use the NEXTSCR and PREVSCR commands to scroll through the other frames of the FORM subsystem. Use these other frames to provide additional information that will be associated with the MYOUTPUT form.

  4. Enter the END command to save your changes.


Examples

To print a file, use the following commands or their respective menu selections:


Using the PRTFILE and PRINT Commands

You can also use the PRTFILE command, followed by the PRINT command, to print the contents of windows. This method enables you to override some of the defaults that are established by the FORM subsystem, such as the destination or the SYSOUT class.

PRTFILE establishes the destination, and PRINT sends the contents of the window to that destination. If you don't specify a destination with the PRTFILE command, PRINT automatically sends the window contents to your default printer. (See Using the PRINT Command and the FORM Subsystem for details about using the PRINT command alone.)

For example, to print the contents of your OUTPUT window on RMT5 instead of on your default printer, follow this procedure:

  1. From the PROGRAM EDITOR window, submit a FILENAME statement or FILENAME function to allocate a destination file for the output. You can use the DEST= and SYSOUT= options to specify the destination and SYSOUT class, respectively. You can also direct the output to the HOLD queue by specifying the HOLD option. (See SYSOUT Data Set Options for the FILENAME Statement for information about other options that you can specify.) For example:
    filename myrpt dest=rmt5 sysout=a hold;

    Note:   The destination printer that you specify in the FILENAME statement or FILENAME function must be the same type of printer as your default printer.  [cautionend]

  2. From a command line, issue the PRTFILE command, specifying the fileref from your FILENAME statement or FILENAME function. For example:
    prtfile myrpt

  3. From the command line of the window whose contents you want to print, issue the PRINT command.

  4. If you want to print the contents of any other windows, issue the PRINT command from the command line of those windows. A requestor window warns you that the destination file already exists. Enter A in the requestor window to append the window contents to the destination file.

  5. From the command line of the first window that you printed, issue the FREE command.

  6. From the PROGRAM EDITOR window, submit a FILENAME statement or FILENAME function to clear (deassign) the fileref. Your output is not actually printed until you perform this step. For example:
    filename myrpt clear;


Example

Follow these steps to use SAS commands to print a file with PRTFILE and PRINT:

  1. Establish a print destination with the FILENAME statement:
    filename myprint dest=dest99 sysout=a;

  2. Identify the fileref as a print destination:
    prtfile myprint replace

  3. Print the file with the PRINT command or menu selection.

When directing output to a print device, for immediate printing use the FREE command or menu selection, and submit:

filename myprint clear;
For delayed printing, ending the SAS session or process forces printing to an output device.


SAS System Options that Relate to Printing

The following system options relate to the printing of SAS output:


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.