Chapter Contents


SAS Companion for the OS/2 Environment


The SAS System under OS/2 takes advantage of the OS/2 printers. You can manage your output in the same manner as you manage output from other OS/2 applications. You can also take advantage of OS/2 fonts that are supported by your printers. For details about using OS/2 printers, see your OS/2 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

From the Print dialog box (shown in The Print Dialog Box), you can choose from several actions:

Note:   The Print dialog box that is shown here might differ from what you see on your system, depending on which version of OS/2 you use to run SAS and on the active SAS window.  [cautionend]

The Print Dialog Box


The Print dialog box displays the destination printer's name and the type of printer. To change the destination printer, click on [Setup...] and select a new printer from the Print Setup dialog box..

You can perform other printing tasks by combining these 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 choices that are related to SAS 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 OS/2 clipboard. If you select Print as Bitmap, you can also choose to print a bitmap of the main SAS window or a bitmap of the entire screen.

Print to File
prints the selected window to a printer file in the correct format. For example, if your currently selected printer is a PostScript printer, the resulting 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 that is readable only by the type of printer that is specified in the Print dialog box. If you want to save the contents of an application window to a text file without printer formatting, use the Save As... item in the File menu.

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

For more detailed information about the Print dialog box, click on the [Help] button.

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 window to select the page setup and the font that is used to print.

You can access this dialog box by selecting Print Setup... from the File menu, or by clicking on [Setup...] from the Print dialog box. If you are using an application that does not provide access to the menus, you can type DLGPRTSETUP at a command line.

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 that is presented in the Print Setup dialog box:

displays the name of the currently selected printer. To change the print job settings, click on [More].

displays the current font. To change the font, click on [Fonts...] and then 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 and displays them on the Print Setup dialog box.

Note:   SAS tabular and columnar reports are formatted in a monospace font. Using 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, 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 and page orientation, which in turn affect the line size and page size. 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 return 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 printer name, the font, and the line and page size that you want to use.

To change the printer settings by using the SAS System Options window, select

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 and orientation for your printed output.

You can access this dialog box by

You can also change the margins and orientation by using the LEFTMARGIN, RIGHTMARGIN, TOPMARGIN, BOTTOMMARGIN, and ORIENTATION system options from the SAS System Options window. To change these options
  1. Select

    Log and procedure output control
    ODS printing

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

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

Page Setup Dialog Box


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

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.

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

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 printers, page formats, margins, fonts, and printer control language in a FORM entry.

To invoke the FORM window, issue the following command:


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

While the majority of the frames in the FORM window are the same across all operating environments, the first frame that you see after issuing the FSFORM command is the Printer Selection frame, which lists the printers that you are able to use under OS/2. Printer Selection Frame shows the default information for this frame. To move from one FORM window frame to the next, use the NEXTSCR and PREVSCR commands. These commands are located under the Tools menu item.

Printer Selection Frame


The information in the Printer Selection frame is also site-dependent, so the printer list at your site will 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 in the catalog that was specified with the FSFORM command (entry type FORM). The next time that 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 typing 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_;

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

Sending Printed Output to a File

You can send your printed output to a file by clicking 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 that is 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 by 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_;

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

Another method of sending printed output to a file is to select the Output to file check box in your printer's Properties notebook Output Port page. When you send output to a file, the contents of the file are overwritten if the file already exists. See your OS/2 documentation for more information about changing printer properties.

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 OS/2 printer. Use the SYSPRINT system option to specify your default printer (and the SYSPRINTFONT system option to specify your printer font, if you want) as described on 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_;

When you submit your job, the SAS System uses the SYSPRINT printer specification to spool your output from the DATA step to the OS/2 printer.

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 OS/2 default printer during SAS installation.

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

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

Chapter Contents



Top of Page

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