Using Universal Printing in a Batch Environment

Setting the Default Printer

A default printer is required for Universal Printing. Unless you specify a default printer, SAS uses a predefined default printer that generates output in PostScript Level 1 language with a 12-point Courier font.
On z/OS, output goes by default to a sequential data set called <prefix>.SASPRT.PS where <prefix> is the value of the SYSPREF= SAS option.

Directing Output to a Universal Printer

Sending Output to a UPRINTER Device

If you are using the SAS windowing environment, you can issue the DMPRINT command in many windows, including the Log, Output, and Program Editor windows, to send window contents to the Universal Printing default printer. You can also use the FILENAME statement to associate a fileref with the default printer, using the device type UPRINTER:
filename myuprt uprinter;
Once a fileref is associated with a printer, you can use that fileref in a PROC PRINTTO statement to print the log or procedure output. For example, the following statement directs any subsequent output to the default UPRINTER:
proc printto log=myuprt print=myuprt; run;
The fileref can also be used in other SAS statements that accept filerefs or in any window command or field that accepts filerefs.
Note: The -ovp option (typically used when a PROC routes log output to a universal printer) is incompatible with the UPRINTER driver. Messages are not overprinted.

The PRINTERPATH SAS Option

Use the PRINTERPATH= SAS option to specify the destination printer for SAS print jobs.
PRINTERPATH=('printer-name'
fileref)
printer-name
must be one of the defined printers. Quotation marks are required around the printer name only when it contains blank spaces.
fileref
is an optional fileref. If a fileref is specified, it must be defined with a FILENAME statement or external allocation. If a fileref is not specified, output is directed to the destination defined in the printer definition or setup. Parentheses are required only when a fileref is specified.
Note: The PRINTERPATH= option is an important option in batch processing. It causes Universal Print drivers to be used for SAS/GRAPH and ODS PRINTER output whenever it is set.

Changing the Default Font

The font that is included in the definition of the current default printer is the font used to generate output, unless you override it with the SYSPRINTFONT= system option. SYSPRINTFONT= sets the font to use when printing to the current printer or to the printer identified with the optional keywords NAMED or ALL. You can specify SYSPRINTFONT= in your configuration file, at SAS invocation, or in an OPTIONS statement.
The syntax is as follows:
SYSPRINTFONT=(face-name <weight> <style> <character-set> <point-size>
<NAMED printer-name | DEFAULT | ALL>)
For more information, see Changing the Default Font.

Setting Up a Universal Printer with PROC PRTDEF

Overview of Setting Up a Universal Printer with PROC PRTDEF

Printer definitions can be created in batch mode for an individual or for all SAS users at your site using PROC PRTDEF. The system administrator can create printer definitions in the registry and make these printers available to all SAS users at your site by using PROC PRTDEF with the SASHELP option. You can create printer definitions for yourself by using PROC PRTDEF. Printer definitions that you create with PROC PRTDEF, and without the SASHELP option, are stored in the SASUSER registry. The complete syntax of the PROC PRTDEF statement is as follows:
PROC PRTDEF <DATA=SAS-data-set><SASHELP><LIST><REPLACE>;
DATA=
specifies a SAS data set that contains the printer definition records. The SAS data set is required to have the variables name, model, device, and dest. The variables hostopt, preview, protocol, trantab, lrecl, desc, and viewer are optional. For more information about these variables, see Required Variables and Optional Variables.
SASHELP
specifies the output location where the printer definitions are stored. Use this option to specify whether the printer definitions are available to all users or just the user who is running PROC PRTDEF. Specifying SASHELP makes the definitions available to all users. You must have permission to write to the SASHELP library. Otherwise, the definitions are stored in SASUSER and are available to the users who are using that SASUSER library.
LIST
specifies that a list of printers that were created or replaced is written to the log.
REPLACE
specifies that any printer name that already exists is to be modified using the information in the printer definition data record.
The following sections contain information about the printer definition variables in the input data set specified by DATA=.

Required Variables

name
The name of the printer is the key for the printer definition record. The name is limited to 80 characters. If a record contains a name that already exists, the record is not processed unless the REPLACE option has been specified. The printer name must have at least one non-blank character and cannot contain a backslash. Leading and trailing blanks are stripped from the name.
model
For a valid list of prototypes or model descriptions, look in the SAS registry editor, which can be invoked with the regedit command. Once the SAS registry editor is open, follow the path Corethen selectPrintingthen selectPrototypes to the list of prototypes. Or invoke the Print Setup window (DMPRTSETUP) and select New to view the list that is displayed on the second window of the Printer Definition wizard.
device
Valid devices are listed in the third window of the Printer Definition wizard and in the SAS registry editor under Corethen selectPrintingthen selectDevice Types The device column is not case-sensitive.
If you specify a device type of catalog, disk, ftp, socket, or pipe, you must also specify the dest variable.
dest
The destination name is limited to 256 characters. Whether this name is case-sensitive depends on the type of device that is specified.

Optional Variables

hostopt
The host options column is not case-sensitive. Host options are limited to 256 characters.
preview
This variable is not used on mainframe platforms. It is used to specify the printer to use for print preview.
protocol
This variable specifies the I/O protocol to use when sending output to the printer. On IBM hosts, the protocol describes how to convert the output to a format that can be processed by a protocol converter that connects the mainframe to an ASCII device. For more information about the use of PROTOCOL, see Setting Up Printers in Your Environment.
trantab
This variable specifies which translate table to use when sending output to the printer. The translate table is needed when an EBCDIC host sends data to an ASCII device. For more information about the use of TRANTAB, see Setting Up Printers in Your Environment.
lrecl
This variable specifies the buffer size or record length to use when sending output to the printer.
desc
This variable specifies the description of the printer. It defaults to the prototype used to create the printer.
viewer
This variable is not used on mainframe platforms. It is used to specify the host system command used during print previews.

Example PROC PRTDEF Jobs in z/OS

Example 1: Defining PostScript, PCL, and PDF Universal Printers

The following SAS program provides an example of how to use PROC PRTDEF in the z/OS operating environment to set up Universal Printing printer definitions.
The following example shows you how to set up various printers. The INPUT statement contains the names of the four required variables. Each data line contains the information that is needed to produce a single printer definition. The DATA= option on the PROC PRTDEF specifies PRINTERS as the input data set that contains the printer attributes. PROC PRTDEF creates the printer definitions for the SAS registry.
Note: You can use an ampersand (&) to specify that two or more blanks separate character values. This feature allows the name and model value to contain blanks.
data printers;
  dest = " ";
  device = "PRINTER";

  input @1 name $14. @16 model $18. @35 hostopt $24.; 
datalines;
Myprinter             PostScript Level 1   SYSOUT=T  DEST=printer1
Laserjet              PCL 5 Printer        SYSOUT=T  DEST=printer5
Color LaserJet        PostScript Level 2   SYSOUT=T  DEST=printer2
;

proc prtdef data=printers; 
run;
Note: SYSOUT=T indicates a binary queue, which is a queue that has no EBCDIC to ASCII conversion.

Example 2: Defining a Universal Printer for an E-Mail Message with a PostScript Attachment

The following SAS program provides an example of how to use PROC PRTDEF in the z/OS operating environment to set up a Universal Printing printer definition that generates an e-mail message with a PostScript attachment.
data printers;
   name='email';
   protocol = 'None';
   model = 'PostScript Level 2 (color)';
   device = 'email';
   dest = 'John.Doe@sas.com';
   hostopt = "recfm=vb Subject='Weekly Report'
      ct='application/PostScript' "; 
   run;
proc prtdef data=printers replace list; run;
Note: ct is an abbreviation for the MIME keyword content_type.

Setting Up Printers in Your Environment

Introduction to Output Variables

The following tables contain information about the required and optional variables that you need to use to create different types of outputs. Use these option values when you define variables for printing to a Universal Printer in a specific operating environment.

z/OS PostScript

PostScript Variables
Print to a PostScript Printer
Generate PostScript Output and Save to a File
Model
One of:
  • PostScript
  • Gray scale PostScript
  • Color PostScript
  • Duplex PostScript
  • PostScript Level 1
  • PostScript Level 2
One of:
  • PostScript
  • Gray scale PostScript
  • Color PostScript
  • Duplex PostScript
  • PostScript Level 1
  • PostScript Level 2
Device Type
PRINTER
DISK
Destination
not applicable
Userid.sasprt.ps
Host Options
sysout=t dest=<printer-address>1
recfm=vb
Protocol
ASCII
ASCII
Translate Table
NONE
NONE
FTP
not applicable
Binary
1SYSOUT=T indicates a binary queue, which is a queue that has no EBCDIC to ASCII conversion. <printer-address> is the LAN queue name, such as PRT23LJ5.

z/OS PCL

PCL Variables
Print to a PCL Printer
Generate PCL Output and Save to a File
Model
One of:
  • PCL4
  • PCL5
  • PCL5e
  • PCL5c
One of:
  • PCL4
  • PCL5
  • PCL5e
  • PCL5c
Device Type
PRINTER
DISK
Destination
not applicable
Userid.sasprt.pcl
Host Options
sysout=t dest=<printer-address>1
recfm=vb
Protocol
ASCII
ASCII
Translate Table
NONE
NONE
FTP
not applicable
Binary
1SYSOUT=T indicates a binary queue, which is a queue that has no EBCDIC to ASCII conversion. <printer-address> is the LAN queue name, such as PRT23LJ5.

z/OS PDF

PDF Variables
Generate PDF Output and Save to a File
Model
PDF
Device Type
DISK
Destination
Userid.sasprt.pdf
Host Options
recfm=vb
Protocol
ASCII
Translate Table
NONE
Buffer Size
255
FTP to PC
Binary