SAS 9.1.3 Language Reference: Concepts, Third Edition, Volumes 1 and 2
Introduction
Universal Printing windows give you control over most printing functions through a graphical user interface. (You can also write a program that uses various SAS language elements to configure your printing environment and to control print jobs.)
System Options That Control Universal Printing
Universal Printing can configured in batch mode and interactive mode by setting option values within an OPTIONS statement. The following options control Universal Printing.
System Option | Description |
---|---|
BINDING | Specifies the binding edge for the printer |
BOTTOMMARGIN | Specifies the size of the margin at the bottom of the page for printing |
COLLATE | Specifies the collation of multiple copies for output for the printer |
COLORPRINTING | Specifies color printing, if it is supported |
COPIES | Specifies the number of copies to make when printing |
DUPLEX | Specifies duplexing controls for printing |
LEFTMARGIN | Specifies the size of the margin on the left side of the page |
ORIENTATION | Specifies the paper orientation to use (either portrait or landscape) |
PAPERDEST | Specifies the bin or output paper tray to receive printed output |
PAPERSIZE | Specifies the paper size to use when printing. |
PAPERSOURCE | Specifies the input paper tray to use for printing |
PAPERTYPE | Specifies the type of paper to use for printing. |
PRINTERPATH | Specifies a printer for Universal Printing print jobs (see Note on page 274) |
RIGHTMARGIN | Specifies the size of the margin on the right side of the page |
SYSPRINTFONT | Specifies the font to use when printing |
TOPMARGIN | Specifies the size of the margin at the top of the page |
Note | The PRINTERPATH option specifies which printer will be used. |
-
If PRINTERPATH is blank, the default printer will be used.
-
If PRINTERPATH is not blank, Universal Printing will be used.
In the Windows environment, the default printer is the current Windows system printer or the printer specified by the SYSPRINT option; therefore, Universal Printing is not used. In all other operating environments, Universal Printing is used and the default printer is Postscript Level 1. To change this printer, use the DMPRINTSETUP command to open the Print Setup window.
Defining Printers for Batch-Mode
Printer definitions can be created for an individual, or for all SAS users at a site, by using the PRTDEF procedure. PROC PRTDEF can be used to do many of the same printer management activities that you can also do with the Universal Printing windows. PROC PRTDEF is especially useful if you use SAS in batch mode, where the Universal Printing windows are unavailable.
Only system administrators or others who have write permission to the SASHELP library can use PROC PRTDEF to create printer definitions for all SAS users at a site.
To define one or more printers with PROC PRTDEF, you first create a SAS data set that contains variables corresponding to printer attributes. PROC PRTDEF reads the data set and converts the variable attributes into one or more printer definitions in the SAS registry.
See Base SAS Procedures Guide for more information about PROC PRTDEF.
Defining New Printers and Previewers with PROC PRTDEF
Introduction
These examples show you how to use PROC PRTDEF to define new printers and to manage your installed printers and previewers.
After a program statement containing PROC PRINTDEF runs successfully, the printers or previewers that have been defined will be displayed in the Print Setup window. A complete set of all available printers and previewers will be displayed in the Printer name list. Printer definitions can also be seen in the Registry Editor window under CORE\\PRINTING\\PRINTERS.
Creating a Data Set that Defines Multiple Printers
When you create a data set to use with PROC PRTDEF to define a printer, you must specify the name, model, device and destination variables.
See the PRTDEF procedure in Base SAS Procedures Guide for the names of the optional variables that you can also use.
data printers; input name $& model $& device $& dest $&; datalines; Myprinter PostScript Level 1 PRINTER printer1 Laserjet PCL 5 Printer PIPE lp -dprinter5 Color LaserJet PostScript Level 2 PIPE lp -dprinter2 ; run;
After you create the data set containing the variables, you run a SAS program that contains PROC PRTDEF. PROC PRTDEF defines the printers that are named in the data set by creating the appropriate entries in the SAS registry.
proc prtdef data=printers usesashelp; run;
Installing a Printer Definition for Multiple Users
This example creates a Tektronix Phaser 780 printer definition with a Ghostview print previewer in the SASUSER registry. The bottom margin is set to two centimeters, the font size to 14 point, and the paper size to A4.
data tek780; name = "Tek780"; desc = "Test Lab Phaser 780P"; model = "Tek Phaser 780 Plus"; device = "PRINTER"; dest = "testlab3"; preview = "Ghostview"; units = "cm"; bottom = 2; fontsize = 14; papersiz = "ISO A4"; run; proc prtdef data=tek780; run;
Adding, Modifying, and Deleting Printer Definitions
This example uses the PRINTERS data set to add, modify, and delete printer definitions. See the PRTDEF procedure in Base SAS Procedures Guide for more variables that you can use to define a printer. The following list describes the variables used in the example:
-
The MODEL variable specifies the printer prototype to use when defining this printer.
-
The DEVICE variable specifies the type of I/O device to use when sending output to the printer.
-
The DEST variable specifies the output destination for the printer.
-
The OPCODE variable specifies what action (Add, Delete, or Modify) to perform on the printer definition.
-
The first Add operation creates a new printer definition for Color Postscript in the registry and the second Add operation creates a new printer definition for ColorPS in the registry.
-
The Mod operation modifies the existing printer definition for LaserJet 5 in the registry.
-
The Del operation deletes the printer definitions for printers named "Gray Postscript" and "test" from the registry.
The following example creates a printer definition in the SASHELP library. Because the definition is in SASHELP, the definition becomes available to all users. Special system administration privileges are required to write to the SASHELP library. An individual user can create a personal printer definition by specifying the SASUSER library instead.
data printers; length name $ 80 model $ 80 device $ 8 dest $ 80 opcode $ 3; input opcode $ & name $ & model $ & device $ & dest $ &; datalines; add Color Postscript PostScript Level 2 (Color) DISK sasprt.ps mod LaserJet 5 PCL 5 DISK sasprt.pcl del Gray Postscript PostScript Level 2 (Gray Scale) DISK sasprt.ps del test PostScript Level 2 (Color) DISK sasprt.ps add ColorPS PostScript Level 2 (Color) DISK sasprt.ps ; proc prtdef data=printers list library=sashelp; run;
Note | If the end user modifies and saves new attributes for an administrator-defined printer in the SASHELP library, the printer will become a user-defined printer in the SASUSER library. Values that are specified by the user will override the values that were set by the administrator. If the user-defined printer definition is deleted, the administrator-defined printer will reappear. |
Creating a Ghostview Previewer Definition for Previewing Postscript Output
This example creates the GSVIEW data set. The variables in the GSVIEW data set have values that PROC PRTDEF uses to produce the print previewer definition in the SAS registry.
-
The NAME variable specifies the printer name that will be associated with the rest of the attributes in the printer definition data record.
-
The DESC variable specifies the description of the printer.
-
The MODEL variable specifies the printer prototype to use when defining this printer.
-
The VIEWER variable specifies the host system commands for print preview.
-
The DEVICE variable should always be DUMMY .
-
DEST should be blank to specify that output is not returned.
data gsview; name = "Ghostview"; desc = "Print Preview with Ghostview"; model= "PostScript Level 2 (Color)"; viewer = 'ghostview %s'; device = "dummy"; dest = " "; run; proc prtdef data=gsview list replace; run;
Exporting and Backing Up Printer Definitions
PROC PRTEXP enables you to backup your printer definitions as a SAS data set that can be restored with PROC PRTDEF.
PROC PRTEXP has the following syntax:
PROC PRTEXP [USESASHELP] [OUT=dataset] [SELECT EXCLUDE] printer_1 printer_2 ... printer_n;
The following example shows how to back up four printer definitions (named PDF, postscript, PCL5 and PCL5c) using PROC PRTEXP.
proc prtexp out=printers; select PDF postscript PCL5 PCL5c; run;
For more information, see the PRTEXP procedure in Base SAS Procedures Guide .
Sample Values for the Device Type, Destination and Host Options Fields
The following list provides examples of the printer values for device type, destination and host options. Because these values can be dependent on each other, and the values can vary by operating environment, several different examples are shown. You might want to refer to this list when you are installing or modifying a printer or when you change the destination of your output.
-
Device Type: Printer
-
z/OS
-
Device type: Printer
-
Destination: (leave blank)
-
Host options: sysout= class-value dest= printer-name
-
-
UNIX and Windows
-
Device type: Printer
-
Destination: printer name
-
Host options: (leave blank)
-
-
VMS
-
Device type: Printer
-
Destination: printer name
-
Host options: passall=yes queue= printer-name
-
-
-
Device Type: Pipe
Note A sample command to send output to an lp-defined printer queue on a UNIX host is lp -ddest
-
UNIX
-
Device Type: Pipe
-
Destination: command
-
Host options: (leave blank)
-
-
-
Device Type: Email
-
Windows, UNIX and VMS
-
Device Type: Email
-
Destination: name@isp.com
-
Host options: (leave blank)
-
-
z/OS
-
Device Type: Email
-
Destination: name@isp.com
-
Host options: recfm=vb
-
-
-
Device Type: FTP
Note An example of a nodename is pepper.unx
-
z/OS
-
Device type: FTP
-
Destination: ftp.out
-
Host options: host= 'nodename' recfm=vb prompt
-
Device type: Printer
-
Destination: printer name
-
Host options: (leave blank)
-
-
Windows
-
Device type: FTP
-
Destination: ftp.out
-
Host options: host= 'nodename' prompt
-
-
UNIX and VMS
-
Device type: FTP
-
Destination: host= 'nodename' prompt
-
Host options: (leave blank)
-
-
-
Device Type: Socket
Note An example of an lp destination queue is lp286nc0.prt:9100
-
UNIX and VMS
-
Device type: Socket
-
Destination: destination-queue
-
Host options: (leave blank)
-
-