Managing Universal Printers Using the PRTDEF
Procedure
About Using the PRTDEF Procedure
Printer definitions can be created for an individual or for all SAS users at a site by using
the PRTDEF procedure. The PRTDEF procedure can be used to do many of the same
printer management activities that you can do with the Universal Printing windows. The
PRTDEF procedure can be used in any execution mode, but it is especially useful if you
use SAS in batch mode, where the Universal Printing windows are unavailable.
To define or modify one or more printers with the PRTDEF procedure, you first create a
SAS data set that contains variables that correspond to printer attributes. These four
variables must be specified for every printer destination:
DEST
specifies the printer destination.
DEVICE
specifies the device name.
MODEL
specifies the name of a printer prototype. For a list of printer prototypes, open the
SAS registry to this key: \CORE\PRINTING\PROTOTYPES.
NAME
specifies the name of the printer.
For a list of optional variables, see “Input Data Set: PRTDEF Procedure” in Base SAS
Procedures Guide. The PRTDEF procedure reads the data set and converts the variable
attributes into one or more printer definitions in the SAS registry.
After you create the printer definition data set, you run the PRTDEF procedure to create
the printer.
Only system administrators or others who have Write permission to the Sashelp library
can use the PRTDEF procedure to create printer definitions for all SAS users at a site.
Individuals have Write permission to their Sasuser library and can use the PRTDEF
procedure to create their own printers. However, the printer definition is stored in the
Sasuser library and is lost if the Sasuser library is deleted. Printer definitions that are
created by individuals are available only when the directory where the printer definition
is stored is specified as the Sasuser library. For information about assigning the Sasuser
library, see “SASUSER= System Option” in SAS System Options: Reference.
For more information see, “PRTDEF Procedure” in Base SAS Procedures Guide.
Examples of Creating New Printers and Previewers Using the
PRTDEF Procedure
Introduction
These examples show you how to use the PRTDEF procedure to define new printers and
to manage your installed printers and previewers.
After a program statement containing the PRTDEF procedure runs successfully, the
printers or previewers that have been defined appear in the Print Setup window. A
276 Chapter 15 Printing with SAS
complete set of all available printers and previewers appear in the Printer name list.
Printer definitions can also be viewed 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 the PRTDEF procedure to define a printer, you
must specify the name, model, device and, destination variables.
See the “PRTDEF Procedure” in Base SAS Procedures Guide in Base SAS Procedures
Guide for the names of the optional variables that you can also use.
The following code creates a data set to use with the PRTDEF procedure:
data printers;
input name $15. model $35. device $8. dest $14.;
datalines;
Myprinter PostScript Level 1 (Gray Scale) PRINTER printer1
Laserjet PCL 5 PCL 5e (RunLength) PIPE lp -dprinter5
Color LaserJet PostScript Level 2 (Color, Duplex) PIPE lp -dprinter2
;
run;
proc print data=printers;
run;
Here is the output:
Output 15.2 The Printer Data Set
After you create the data set containing the variables, you run the PRTDEF procedure.
The PRTDEF procedure creates the printers that are named in the data set by creating the
appropriate entries in the SAS registry.
proc prtdef data=printers usesashelp replace;
run;
The USESASHELP option specifies that the printer definitions are to be placed in the
Sashelp library, where they are available to all users. If the USESASHELP option is not
specified, then the printer definitions are placed in the current Sasuser library, where
they are available to the local user only. The printers that are defined are available only
in the local Sasuser directory. However, to use the USESASHELP option, you must have
permission to write to the Sashelp library.
Managing Universal Printers Using the PRTDEF Procedure 277

Get SAS 9.4 Language Reference, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.