Chapter Contents

Previous

Next
SAS Companion for the Microsoft Windows Environment

Printing

The SAS System under Windows uses the Windows Print Manager. This means you can spool printed output from your SAS session (such as the contents of the PROGRAM EDITOR and OUTPUT windows and results of procedures and the DATA step) to the Print Manager and manage this output in the same manner as you manage output from other Windows applications. You can also take advantage of Windows TrueType fonts and fonts supported by your printers. For details about using the Print Manager, see your Windows documentation. Producing Graphics discusses how to route graphics from your SAS session to printers.


Printing from within a SAS Window

To print the contents of one of the SAS windows, make that window active (by clicking on it) and select

File
[arrow]
Print...
From the Print dialog box (shown in The Print Dialog Box), you can choose from several options:

Note:   The Print dialog box might differ somewhat from what you see on your system, depending on which Windows operating system you use to run SAS, and on the active SAS window.  [cautionend]

The Print Dialog Box

[IMAGE]

The Print dialog box displays the destination printer's name, status, and type of printer. To change the destination printer, click on the Name combo box and select a new printer from the list.

You can perform other printing tasks by combining the above methods. For example, you can print the contents of the currently selected window as a bitmap to a printer file by selecting both the Print to File and Print as Bitmap check boxes.

Here is a summary of the SAS-related options that the Print dialog box offers:

Contents of:
displays the name of the window whose contents you want to print. You can choose between the currently selected window and the Windows clipboard. If you select Print as Bitmap, you can also print a bitmap of the main SAS window or of the entire screen.

Print to File
prints the selected window to a printer file. For example, if your currently selected printer is a PostScript printer, the resulting printer file will be in PostScript format. The Print dialog box prompts you for a filename.

Note that you cannot edit the resulting printer file; it is in a format readable only by the type of printer specified in the Print dialog box. If you want to save the contents of an application window to a text file without printer formatting, select the File pull-down menu and then select Save As....

Print as Bitmap
prints the currently selected window as a bitmap instead of as text.

Force Bitmaps to Fill Page
scales the bitmap as needed to fill the entire printed page. The Print dialog box window displays this checkbox only when you select Print as Bitmap.

Page range
specifies the range of pages of output to print. Selection is enabled if the current window is a text window with selected text.

For more detailed information about the Print dialog box, click the [?] button and then click the area you want to know about.

Note:   Although the Print dialog box offers a Collate option, this option is enabled only if the printer supports collating on its own. The SAS System does not collate its output pages.  [cautionend]


Changing the Print Options

The Print Setup dialog box (shown in The Print Setup Dialog Box) lets you control how the SAS System prints information. For example, you use this dialog box to select the page setup and the font used to print.

You can access this dialog box by selecting

File
[arrow]
Print Setup...
You could also click on [Setup...] from the Print dialog box. If you are using an application that does not provide access to the menus, you can enter DLGPRTSETUP at a command line. You can use the DLGPRTSETUP command to programmatically specify every aspect of your printer settings. For details, see DLGPRTSETUP.

The Print Setup Dialog Box

[IMAGE]

The SAS System consults these sources for default printer settings (in order of precedence, first to last):

Here is a summary of the information presented in the Print Setup dialog box:

Printer:
displays the name of the currently selected printer. To change the settings specific to your printer, click on [Properties]. If you accessed the Print Setup dialog box using the [Setup...] button on the Print dialog box, you cannot change the printer destination from this dialog box.

Font
displays the current font. To change the font, click on [Font...] and select a new font, style, and size from the Font dialog box.

When you change the font size, the SAS System recalculates the maximum LINESIZE and PAGESIZE values displayed on the Print Setup dialog box.

Note:   SAS tabular and columnar reports are formatted assuming the use of a monospace font. Use of a proportionally spaced font might produce improperly formatted reports.  [cautionend]

Line Size and Page Size
display the maximum calculated line size and page size, respectively, for the current printer and font settings. Although you cannot set these values directly from this dialog box, you can adjust them by changing the page setup, the font, and the destination printer. Click on [Page Setup...] to access the Page Setup dialog box. From there, you can change the margins, page orientation, and papersize, which in turn affects the line size, page size, and papersource. The LINESIZE and PAGESIZE system options change when you click on [OK].

Also, the Print Setup dialog box contains a graphic that depicts the current page orientation and margin settings.

Note:   The margin settings affect printed output only.  [cautionend]

Use Forms
specifies whether to use SAS System print forms, as described in Using SAS System Print Forms.

To revert back to the default printer settings, click on[Default].

Changing the Print Options Using the SAS System Options Window

To change the printer options using the SAS System Options window, you must know the values of the printer name, font, and line and page size you want to use.

To open the SAS System Options window, select

Tools
[arrow]
Options
[arrow]
System
You can then make the following changes to the printing system options:


Changing the Page Setup Options

The Page Setup dialog box (shown in Page Setup Dialog Box) lets you set the margins, orientation, paper, and paper source for your printed output.

You can access this dialog box by:

You can also change the margins, orientation, paper, and paper source using the LEFTMARGIN, RIGHTMARGIN, TOPMARGIN, BOTTOMMARGIN, ORIENTATION, PAPERSIZE, PAPERSOURCE, and PAPERTYPE system options from the SAS System Options window. To change these options:
  1. Select

    Tools
    [arrow]
    Options
    [arrow]
    System...
    [arrow]
    Log and procedure output control
    [arrow]
    ODS printing

  2. Place the cursor over the appropriate system option, click the right mouse button, and select Modify Value.

  3. Enter a new value and click on [OK]

Page Setup Dialog Box

[IMAGE]

Here is a summary of the information presented in the Page Setup dialog box:

Paper
lets you select the paper size and source of the paper (such as automatic selection, envelop feeder, manual feeder, or printer tray) for printing. To change the paper size or source, click in the combo box and highlight a selection. The paper size can be one of the following; additional paper sizes may be supported. Note that not all printers support these paper sizes:

LETTER
Letter, 8-1/2-by-11-inch paper

LEGAL
Legal, 8-1/2-by-14-inch paper

A4
A4 Sheet, 210-by-297-millimeter paper

CSHEET
C Sheet, 17-by-22-inch paper

DSHEET
D Sheet, 22-by-34-inch paper

ESHEET
E Sheet, 34-by-44-inch paper

LETTERSMALL
Letter Small, 8-1/2-by-11-inch paper

TABLOID
Tabloid, 11-by-17-inch paper

LEDGER
Ledger, 17-by-11-inch paper

STATEMENT
Statement, 5-1/2-by-8-1/2-inch paper

EXECUTIVE
Executive, 7-1/4-by-10-1/2-inch paper

A3
A3 sheet, 297-by-420-millimeter paper

A4SMALL
A4 small sheet, 210-by-297-millimeter paper

A5
A5 sheet, 148-by-210-millimeter paper

B4
B4 sheet, 250-by-354-millimeter paper

B5
B5 sheet, 182-by-257-millimeter paper

FOLIO
Folio, 8-1/2-by-13-inch paper

QUARTO
Quarto, 215-by-275-millimeter paper

10X14
10-by-14-inch paper

11X17
11-by-17-inch paper

NOTE
Note, 8-1/2-by-11-inch paper

ENV_9
#9 Envelope, 3-7/8 by 8-7/8 inches

ENV_10
#10 Envelope, 4-1/8 by 9-1/2 inches

ENV_11
#11 Envelope, 4-1/2 by 10-3/8 inches

ENV_12
#12 Envelope, 4-3/4 by 11 inches

ENV_14
#14 Envelope, 5 by 11-1/2 inches

ENV_DL
DL Envelope, 110 by 220 millimeters

ENV_C5
C5 Envelope, 162 by 229 millimeters

ENV_C3
C3 Envelope, 324 by 458 millimeters

ENV_C4
C4 Envelope, 229 by 324 millimeters

ENV_C6
C6 Envelope, 114 by 162 millimeters

ENV_C65
C65 Envelope, 114 by 229 millimeters

ENV_B4
B4 Envelope, 250 by 353 millimeters

ENV_B5
B5 Envelope, 176 by 250 millimeters

ENV_B6
B6 Envelope, 176 by 125 millimeters

ENV_ITALY
Italy Envelope, 110 by 230 millimeters

ENV_MONARCH
Monarch Envelope, 3-7/8 by 7-1/2 inches

ENV_PERSONAL
6-3/4 Envelope, 3-5/8 by 6-1/2 inches

FANFOLD_US
U.S. Standard Fanfold, 14-7/8-by-11-inch paper

FANFOLD_STD_GERMAN
German Standard Fanfold, 8-1/2-by-12-inch paper

FANFOLD_LGL_GERMAN
German Legal Fanfold, 8-1/2-by-13-inch paper

Margins
displays the amount of space to leave blank from the top, bottom, left, and right edges of the paper. To change the margins, click in the text box and type in the margin size.

Orientation
lets you select either Portrait or Landscape. Portrait prints vertically, and landscape prints horizontally.


Previewing Your Output before You Print

To see how the contents of a window will appear as printed output, select the window you want to preview and then select

File
[arrow]
Print Preview
Alternatively, you can click the Print Preview toolbar button.

In the Preview window, you can use the [Next] and [Previous] buttons to navigate through the pages to be printed. The current page number and total number of pages are displayed at the bottom of the window. You can also magnify your view of the current page (to 100%) by clicking on [Zoom], or by simply clicking inside of the page. To reduce your view, click on [Zoom] or inside of the page again.

In the Print Preview window, you can navigate by using the following shortcut keys:

Key Action in Full Page mode Action in Zoom mode
PgDn Advance to next page Scroll down on current page
PgUp Go back to previous page Scroll up on current page
Ctrl+PgDn none Scroll right on current page
Ctrl+PgUp none Scroll left on current page
Ctrl+Home Go to first page Go to first page
Ctrl+End Go to last page Go to last page

Note:   

Not all SAS application windows support the Print Preview feature.  [cautionend]


Using SAS System Print Forms

To use a form to print from the SAS System, select the Use Forms check box in the Print Setup dialog box. When you print, the SAS System prints your output with the current print form.

To specify a print form as the current print form, use the FORMNAME command, or specify the FORMS option in your SAS configuration file or in the SAS System Options window. To learn the name of the current form, issue the FORMNAME command with no parameters.

Using the FORM Window

The FSFORM command opens the FORM window, in which you can define print forms to use when you print SAS output. You can specify printer, page formats, margins, fonts, and printer control language in a FORM entry.

SAS print forms are especially useful when you use the PRINT command from within an interactive SAS session and when you print from SAS/AF windows.

To invoke the FORM window, issue the following command:

FSFORM catalog-name.form-name

See the SAS System online Help for more information about the FSFORM command.

While the majority of the frames in the FORM window are the same across all operating systems, the first frame you see after issuing the FSFORM command is the Printer Selection frame which lists the printers you are able to use under Windows. Printer Selection Frame shows the default information for this frame. (To navigate though the FORM window frames, use the Next Screen and Previous Screen commands located under the Tools menu.)

Printer Selection Frame

[IMAGE]

The information in the Printer Selection frame is also site-dependent, so the printer list at your site may be different from the one shown in Printer Selection Frame.

The Printer Selection frame appears only when you create a new print form. After you create a form, it is stored in your user profile catalog or whatever catalog was specified with the FSFORM command (entry type FORM). The next time you modify this form, the Printer Selection frame is skipped. You cannot return to the Printer Selection frame from the second FORM window frame.


Printing with SAS Commands

If you prefer entering commands to using menus, you can use the PRINT or SPRINT command to print the contents of the active window. For more information about these commands, see the SAS System Help.


Sending DATA Step Output to a Printer

You may want to spool your DATA step output to a printer instead of to a file. Use the FILENAME statement and the PRINTER device-type keyword to accomplish this, as in the following example:

filename myfile printer;
data _null_;
   set mydata;
   file myfile;
   where city='Cincinnati';
   put _all_;
run;

In this example, the PRINTER device-type keyword specifies to print the output to the printer specified in the SYSPRINT system option. For more information on the SYSPRINT system option, see SYSPRINT.


Sending Printed Output to a File

You can send your printed output to a file by selecting the Print to File check box in the Print dialog box, and then specifying the name of a file to print to. This is not the same as a save operation; the resulting printer file contains all the printer control language necessary to support whatever options you have chosen with the Printer Setup dialog box, such as fonts and page orientation. In most cases, this printer file is not readable with a text editor; it is meant only to be sent to the printer.

You can also route printed output to a file using the FILENAME statement, which is useful for routing DATA step output. Here is an example:

filename myfile printer altdest='c:\sas\results.dat';
data _null_;
   set qtr1data;
   file myfile;
   where sales ge 1000;
   put _all_;
run;

In this example, the output from the DATA step is routed to a file, yet still contains all the printer control information necessary for you to use your printer to produce formatted output.

Another method of sending printed output to a file is to direct the output to the FILE: device instead of a printer in the Windows printer Properties dialog box Ports page. If you assign the FILE: device to a printer, Windows prompts you for a file name each time you print. When you send output to a file, the contents of the file are overwritten if the file already exists. For more information about changing printer properties, see your Windows documentation.


Printing in Batch Mode

When you run SAS jobs in batch mode, you do not have access to the Print and Printer Setup dialog boxes, but you can still take advantage of the Print Manager. Use the SYSPRINT system option to specify your default printer (and the SYSPRINTFONT system option to specify your printer font, if desired) as described in SYSPRINT. For example, suppose your SAS configuration file contains the following option:

-sysprint "f2hp5"
Then, your SAS program might contain the following statements:
filename myfile printer;
data _null_;
   set schools;
   file myfile;
   where enrolled le 500;
   put _all_;
run;

When you submit your job, the SAS System uses the SYSPRINT printer specification to spool your output from the DATA step to the Windows Print Manager.


Default Printer Details

The SAS System looks for a default printer as follows (in order of precedence, first to last):

The SYSPRINT system option is defined as the Windows default printer during SAS installation.

To see the value of the SYSPRINT system, open the Print Setup dialog box either by:

To change the SYSPRINT system option, see Changing the Print Options.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.