PRTDEF Procedure
Example 4: Adding, Modifying, and Deleting Printer Definitions
| Features: |
|
Details
This example does the following:
- adds two printer definitions
- modifies a printer definition
- deletes two printer definitions
Program
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 (DeltaRow) DISK sasprt.pcl
del Gray Postscript PostScript Level 1 (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 replace list;
run;
Program Description
Create the PRINTERS data set and specify which actions
to perform on the printer definitions. The
PRINTERS data set contains the variables whose values contain the
information that is needed to produce the printer definitions. 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
which 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 SAS registry. The second Add operation creates a
new printer definition for ColorPS in the SAS registry. The Mod operation
modifies the existing printer definition for LaserJet 5 in the registry.
The Del operation deletes the printer definitions for test from the
registry. The
& specifies
that two or more blanks separate character values. This allows the
name and model value to contain blanks.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 (DeltaRow) DISK sasprt.pcl
del Gray Postscript PostScript Level 1 (Gray Scale) DISK sasprt.ps
del test PostScript Level 2 (Color) DISK sasprt.ps
add ColorPS PostScript Level 2 (Color) DISK sasprt.ps
;
Create multiple printer definitions and write them to
the SAS log. The DATA= option specifies
the input data set PRINTERS that contains the printer attributes.
PROC PRTDEF creates five printer definitions, two of which have been
deleted. The LIST option specifies that a list of printers that are
created or replaced will be written to the log.
proc prtdef data=printers replace list;
run;
Log
The SAS Log After Modifying and Deleting Printers
15 data printers;
16 length name $ 80
17 model $ 80
18 device $ 8
19 dest $ 80
20 opcode $ 3
21 ;
22 input opcode $& name $& model $& device $& dest $&;
23 datalines;
NOTE: The data set WORK.PRINTERS has 5 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
29 ;
30 proc prtdef data=printers list replace;
31 run;
NOTE: Printer Color PostScript modified.
NOTE: Printer LaserJet 5 modified.
NOTE: Printer Gray Postscript deleted.
NOTE: Printer test deleted.
NOTE: Printer ColorPS modified.
NOTE: PROCEDURE PRTDEF used (Total process time):
real time 0.04 seconds
cpu time 0.03 seconds
Last updated: September 15, 2026