Configuring Universal Printing Using the Windowing Environment

Overview of the Universal Printing Menu

SAS Universal Printing windows are accessible from the File menu.
The following display shows the File menu containing the Universal Printing choices of Page Setup, Print Setup, Print Preview, and Print.
File Menu Displaying Universal Printing Options
File Menu Displaying Universal Printing Options
Menu Choices or Commands to Open Universal Printing Windows
Menu Choice
Equivalent Command
Page Setup
DMPAGESETUP
Print Setup
DMPRINTSETUP
Print Preview
DMPRTPREVIEW
Print
DMPRINT
Windows Specifics: In the Windows operating environment, SAS uses the Windows print windows as the default. To access the Universal Printing user interface, the UNIVERSALPRINT system option must be set. To do this, include the following line of code in the string that you use to invoke SAS in Windows:
-uprint 
UPRINT is an alias for the UNIVERSALPRINT system option.
You can open Universal Printing windows by entering commands at the command line or into the command box in the menu bar. The following table lists the commands for the most common tasks.
Commands to Open Universal Printing Windows
Action
Command
Print the current window
DMPRINT
Change the default printer
DMPRINT or DMPRINTSETUP
Create a new printer or previewer definition
DMPRTCREATE PRINTER or DMPRTCREATE PREVIEWER
Modify, add, remove, or test printer definitions
DMPRINTSETUP
Show default printer properties sheet
DMPRINTPROPS
Show page properties sheet
DMPAGESETUP
Print preview the current window
DMPRTPREVIEW

Setting Up Printers

Print Setup Window

The Filethen selectPrint Setup menu selection opens the Print Setup window, where you can perform the following tasks:
  • Change the default printer.
  • Remove a printer from the selection list.
  • Print a test page.
  • Open the Printer Properties window.
  • Launch the New Printer wizard.
Alternatively, you can issue the DMPRINTSETUP command.

Change the Default Printer

To change the default printer device for this SAS session and future SAS sessions, follow these steps:
  1. Select Filethen selectPrint Setup. The Print Setup window appears.
  2. Select the new default device from the list of printers in the Printer field.
  3. Click OK.
Alternatively, you can issue the DMPRINTSETUP command.

Remove a Printer from the Selection List

To remove a printer from the selection list:
  1. Select Filethen selectPrint Setup. The Print Setup window appears.
  2. Select the printer that you want to delete from the list of printers in the Printer field
  3. Click Remove.
Note: Only your system administrator can remove printers that the administrator has defined for your site. If you select a printer that was defined by your system administrator, the Remove button will be unavailable.
Alternatively, you can issue the DMPRINTSETUP command.

Define a New Printer

While Universal Printing provides you with predefined printers, you can also add your own printers with the Define a New Printer wizard. This wizard guides you step-by-step through the process of installing a printer.
To start the New Printer wizard and define a new printer, follow these steps:
  1. Select Filethen selectPrint Setup and click New.
    The following window appears.
    Printer Definition Window to Enter Name and Description
    Printer Definition Window to Enter Name and Description
    Alternatively, you can either issue the DMPRTCREATE PRINTER command or issue the DMPRINTSETUP command and click New.
  2. Enter the name and a description for the new printer (127–character maximum, no backslash characters, not case sensitive).
    The printer name is required. The description is optional.
  3. Click Next to proceed to Step 2 of the wizard.
    Select a printer model. If your exact printer model is not available, select a general model that is compatible with your printer. For example, for the HP LaserJet printer series, select PCL5 for monochrome printers or PCL5c for color printers.
    Note: General models might provide fewer options than specific models.
    Printer Definition Window to Select Printer Model
    Printer Definition Window to Select Printer Model
  4. Click Next to proceed to Step 3 of the wizard.
    The following window appears:
    Printer Definition Window to Select Output Device
    Printer Definition Window to Select Output Device
  5. Select the Device type for your print output. Put this sentence in a paragraph under the numbered item
    The device type selections are host-dependent.
    If you select Catalog, Disk, Ftp, Socket, or Pipe as the device type, then you must specify a destination.
    If you select a device type of Printer, then a destination might not be required, because some operating environments use the Host options box to route output.
    Note: Examples for your operating system of Device Type, Destination, and Host options are also provided in Sample Values for the Device Type, Destination, and Host Options Fields.
  6. Enter the Destination for your file.
    The destination is the target location for your device type. For example, if your device type is disk, then your destination is an operating environment-specific filename. With some system device types, the destination might be blank and you can specify the target location using the Host options box.
  7. Select or enter any host-specific options for the device that you chose.
    This field might be optional for your operating environment. For a list of host options, refer to the FILENAME statement information for your operating environment.
    Note: The Destination and Host Options lists can also be populated using the REGISTRY procedure. Click the Help button in step 3 to refer to the “Populating Destination and Host Option Lists” topic, which contains more details.
  8. Click Next to proceed to Step 4 of the wizard, in which you select from a list of installed print previewers.
    If no previewers are defined, proceed to the next step of the wizard.
    Printer Definition Window to Select Previewer
    Printer Definition Window to Select Previewer
    If the previewer selection box appears, select the previewer for this printer. If you do not need a previewer, choose None or leave the field blank.
    Note: You can add a previewer to any printer through the DMPRTCREATE PREVIEWER command. For more information, see Define a New Previewer.
    Note: It is not required that printers and print previewers share a common language.
  9. Click Next to proceed to Step 5 of the wizard.
    The following window appears:
    Printer Definition Window to Complete Process
    Printer Definition Window to Complete Process
  10. Click Previous to change any information. Click Finish when you have completed your printer definition.
You have now finished setting your default printer.
After you have returned to the Print Setup window, you can test your default printer by clicking Print Test Page.
Note: You can also use the PRTDEF procedure to define a printer programmatically. For more information, see Managing Universal Printers Using the PRTDEF Procedure.

Set Printer Properties for Your Default Printer

Printer properties that you can change include the following:
  • the printer name and description
  • the printer destination device and its properties
  • the default font for the printer
  • advanced features such as translation tables, printer resolution, and the print previewer associated with the printer
To change printer properties for your default printer, follow these steps:
  1. Select Filethen selectPrint Setup and choose Properties.
    The Printer Properties window appears.
    Alternatively, you can issue the DMPRTPROPS command.
  2. From the Printer Properties window, select the tab that contains the information that you need to modify.
    • In the Name tab, you can modify the printer name and the printer description.
      Note: The printer name is not case sensitive. If you change only the casing, the printer name change fails. To change the case of the printer name, you can either delete the printer and recreate it with the new casing, or you can modify the name of the printer, save the modifications, and then change the name again to the name and casing that you want.
      Printer Properties Window Displaying Name Tab
      Printer Properties Window Displaying Name Tab
    • The Destination tab enables you to designate the device type, destination, and host options for the printer. See Sample Values for the Device Type, Destination, and Host Options Fields for examples.
      Printer Properties Window Displaying Destination Tab
      Printer Properties Window Displaying Destination Tab
    • The Font tab controls the available font options. The selections available in the drop-down boxes are printer specific. The font size is in points.
      Note: This window enables you to set attributes for the default fonts. Typically, procedure output is controlled by the fonts specified by the ODS style or by program statements that specify font attributes.
      Printer Properties Window Displaying Font Tab
      Printer Properties Window Displaying Font Tab
    • The Advanced tab lists the Resolution, Protocol, Translate table, Buffer size, Previewer, and Preview command options for the printer. The information in the drop-down fields is printer specific.
      Printer Properties Window Displaying Advanced Tab
      Printer Properties Window Displaying Advanced Tab
      Resolution
      specifies the resolution for the printed output in dots per inch (dpi).
      Protocol
      provides the mechanism for converting the output to a format that can be processed by a protocol converter that connects the EBCDIC host mainframe to an ASCII device. Protocol is required in the z/OS operating environment, and if you must use one, select one of the protocol converters that are listed.
      Translate table
      manages the transfer of data between an EBCDIC host and an ASCII device. Normally, the driver selects the correct table for your locale; the translate table needs to be specified only when you require nonstandard translation.
      Buffer size
      controls the size of the output buffer or record length. If the buffer size is left blank, a default size is used.
      Previewer
      specifies the Previewer definition to use when Print Preview is requested. The Previewer box contains the previewer application that you have defined. See Define a New Previewer.
      Preview command
      is the command that is used to open an external printer language viewer. For example, if you want Ghostview as your previewer, type ghostview %s. When a Preview Command is entered into a Printer definition, the printer definition becomes a previewer definition. The Preview Command must a valid command. When the command is executed as part of the preview process the %s are replaced with the name of a temporary file that contains the input for the preview command.
    Note: The Previewer and Preview Command fields are mutually exclusive. When you enter a command path into the Preview Command field, the Previewer box is dimmed.

How to Specify a Printer for Your Session

The PRINTERPATH= system option enables you to specify a universal printer to use for the current SAS session. This printer specification is not retained across SAS sessions. The PRINTERPATH= system option is primarily used in batch mode, when there is no windowing environment in which to set the default printer. This option accepts a character string as its value. For example:
options printerpath=myprinter;
options printerpath="Print PostScript to disk";
Note: If the printer name contains blanks, you must enclose it in quotation marks.
You can get a list of valid character strings from two places:
  • The list of printers in the Printer field of the Print Setup window.
  • Submit this code:
    proc qdevice out=printers;
       printer _all_;
    run;
    
    proc print data=printers;
       var name desc;
       where nametype contains "Printer";
    run;
You can also override the printer destination by specifying a fileref with the PRINTERPATH= system option:
options printerpath= (myprinter printout);
filename printout path;

Printing with Universal Printing

Print a Test Page

To print a test page, follow these steps:
  1. Select Filethen selectPrint Setup and choose Print Test Page to open the Print Setup window.
  2. Select the printer for which you would like a test page from Printer list view.
  3. Click Print Test Page.
Alternatively, you can issue the DMPRINTSETUP command.

Print the Contents of an Active SAS Window

To print the contents of a window in SAS, follow these steps:
  1. Click inside the window to make it active.
  2. Select Filethen selectPrint.
    A print window appears. Your print window might differ from the window that follows.
    Alternatively, you can issue the DMPRINT command.
    Print Window
    Print Window
  3. If the Use Forms check box is visible, clear it in order to use Universal Printing.
  4. From the Printer group box, select the name of the printer definition.
  5. Enter the number of copies that you want.
  6. If you want to save your print job to a file, follow these steps:
    1. Select Print to File.
    2. Select OK. The File Selection window appears.
    3. Select an existing file or enter a new filename.
    Note: If you print to an existing file, the contents of the file are either overwritten or appended, depending on whether you choose replace or append from the open print window. Most viewers for EMF, GIF, SVG, and PNG files do not view appended files. When append is selected with a PDF printer, a merged PDF file is not produced.
  7. Set additional printing options.
    The fields in the Page Options area provide choices according to the content in the SAS window that you are trying to print. By default, SAS prints the entire contents of the selected window.
    Page Options
    Item to Print
    Do This
    Selected lines of text in a window
    Note: not available on z/OS
    Select the text that you want to print, and then open the Print window. In the Page Options box, check the Print Selected Text box.
    The page that is currently displayed in the window
    Select Current page.
    A range of pages or other individual pages
    Select Range and enter the page numbers in the Pages field. Separate individual page numbers and page ranges with either a comma (,) or a blank. You can enter page ranges in any of these formats:
    • n–m prints all pages from n to m, inclusive.
    • –n prints all pages from page 1 to page n.
    • n– prints all pages from page n to the last page.
    In color
    Check the Print Color box.
    Line numbers
    Check the Print Line Numbers box.
    Page numbers
    Check the Print Page Numbers box.
    A graph
    Use the DMPRINT command, or select Filethen selectPrint. Verify that the Use SAS/GRAPH Drivers check box is deselected in order to use Universal Printing.
  8. Click OK to print.

Working with Previewers

Define a New Previewer

Previewers enable you to preview a print job. SAS does not set a default previewer application. To use the Print Preview feature in SAS, you or your system administrator must first define a previewer for your system.
z/OS Specifics: Print Previewers are not supported on z/OS.
Previewers can be defined using the New Previewer wizard. To use the New Previewer wizard to define a new print previewer, follow these steps:
  1. Issue the DMPRTCREATE PREVIEWER command.
    The following window appears:
    Previewer Definition Window to Enter Name and Description
    Previewer Definition Window to Enter Name and Description
  2. Enter the name and a description for the new previewer (127–character maximum, no backslashes, not case sensitive).
    The previewer name is required. The description is optional.
  3. Click Next to proceed to Step 2 of the wizard.
    Previewer Definition Window to Enter Previewer Language
    Previewer Definition Window to Enter Previewer Language
  4. Select the printer model that you want to associate with your previewer definition.
    The PostScript, PCL, or PDF language generated for the model must be a language that your external viewer package supports. For best results, select the generic models such as PostScript Level 1 (Color) or PCL 5.
  5. Click Next to proceed to Step 3 of the wizard.
    Previewer Definition Window to Enter Command to Open Previewer Application
    Previewer Definition Window to Enter Command to Open Previewer Application
  6. Enter the command or commands used to open the previewer application, followed by %s where you would normally put the input filename.
    For example, if the command for starting your previewer is “ghostview,” then you would type ghostview %s in the text field.
    You can pre-populate or seed a list of commands used to invoke a print preview application. For more information, see Seeding the Print Previewer Command Box.
    Note: The %s directive can be used as many times as needed in the commands for starting the viewer. However, the start command needs to be the fully qualified command if it is not in the machine's command path.
  7. Click Next to proceed to Step 4 of the wizard.
    Previewer Definition Window to Complete Process
    Previewer Definition Window to Complete Process
  8. Click Previous to correct any information. Click Finish when you have finished defining your default previewer.
The newly defined previewer displays a previewer icon in the Print Setup window.
Print Setup Window Displaying New Previewer
Print Setup Window Displaying New Previewer
This previewer application can be tested with the Print Test Page button on the Print Setup window.

Seeding the Print Previewer Command Box

Print Preview is supported by print previewer applications such as Ghostview, gv, and Adobe Reader. The Preview command box that appears in the Previewer Definition wizard (Previewer Definition Window to Enter Command to Open Previewer Application) and on the Advanced tab of the Printer Properties window (Printer Properties Window Displaying Advanced Tab) can be pre-populated or seeded with a list of commands. These commands are used to invoke print previewer applications that are available at your site. Users and administrators can manually update the registry, or define and import a registry file that contains a list of previewer commands. This is an example of a registry file.
[CORE\PRINTING\PREVIEW COMMANDS]
 "1"="/usr/local/gv %s"
 "2"="/usr/local/ghostview %s"

Previewing Print Jobs

You can use the print preview feature if a print viewer is installed for the designated printer. Print Preview is always available from the File menu in SAS. You can also issue the DMPRTPREVIEW command.

Set Page Properties

You can customize how your printed output appears in the Page Setup window. Depending on which printer you have currently set, some of the Page Setup options that are described in the following steps might be unavailable.
To customize your printed output, follow these steps:
  1. Select Filethen selectPage Setup.
    The Page Setup window appears.
    Alternatively, you can issue the DMPAGESETUP command.
  2. Select a tab to open windows that control various aspects of your printed output.
    Descriptions of the tabbed windows follow.
The Page Setup window consists of four tabs: General, Orientation, Margins, and Paper.
  • The General tab enables you to change the options for Binding, Collate, Duplex, and Color Printing.
    Page Setup Window Displaying the General Tab
    Page Setup Window Displaying the General Tab
    Binding
    specifies the binding edge (Long Edge or Short Edge) to use with duplexed output. This sets the Binding option.
    Collate
    specifies whether the printed output should be collated. This sets the Collate option.
    Duplex
    specifies whether the printed output should be single-sided or double-sided. This sets the Duplex option.
    Color Printing
    specifies whether output should be printed in color. This sets the COLORPRINTING option.
  • The Orientation tab enables you to change the output's orientation on the page. The default is Portrait. This tab sets the ORIENTATION option.
    Page Setup Window Displaying the Orientation Tab
    Page Setup Window Displaying the Orientation Tab
  • The Margin tab enables you to change the top, bottom, left, and right margins for your pages. The value range depends on the type of printer that you are using. The values that are specified on this tab set the TOPMARGIN, BOTTOMMARGIN, LEFTMARGIN, and RIGHTMARGIN options.
    Page Setup Window Displaying the Margins Tab
    Page Setup Window Displaying the Margins Tab
  • The Paper tab specifies the Size, Type, Source, and Destination of the paper used for the printed output.
    Page Setup Window Displaying Paper Tab
    Page Setup Window Displaying the Paper Tab
    Size
    specifies the size of paper to use by setting the PAPERSIZE option. Paper sizes include Letter, Legal, A4, and so on.
    Type
    specifies the type of paper to use. Examples of choices include Standard, Glossy, and Transparency. This sets the PAPERTYPE option.
    Source
    designates which input paper tray is to be used. This sets the PAPERSOURCE option.
    Destination
    specifies the bin or output paper tray that is to be used for the resulting output. This sets the PAPERDEST option.
Note: Page settings are stored in the SAS registry. Although your page settings should remain in effect from one SAS session to another, changing default printers could lose, change, or disable some of the settings. If you change printers during a SAS session, check the Page Setup window to ensure that all of your settings are valid for your new default printer.