|SAS Companion for the Microsoft Windows Environment|
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
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.
The Print Dialog Box
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:
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....
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.
|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
The Print Setup Dialog Box
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:
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.
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
To revert back to the default printer
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
|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:
|Tools||Options||System...||Log and procedure output control||ODS printing|
Page Setup Dialog Box
Here is a summary of the information presented in the Page Setup dialog box:
|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
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|
Not all SAS
application windows support the Print Preview
|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.
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:
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
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.
Top of Page
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.