Errors When Using Page X of Y in SAS ODS pdf Statements

By | March 13, 2015

SAS ODSI ran across a familiar error this week, so I figured I might as well finally document it on this blog. My organization primarily uses Lexmark printers, and print drivers are included in the standard PC image. Apparently the drivers installed on the standard image are not considered “valid printer drivers” by SAS, because we generate errors in our PC SAS 9.3 logs when we attempt to create a .pdf file using the SAS ODS pdf destination. For example, if my colleagues submit a statement such as:

ods escapechar = '^';
ods pdf file="output.pdf"; 
proc print data=sashelp.class(obs=5); 
footnote j=r 'page ^{thispage} of ^{lastpage}';
run; 
ods pdf close;

Errors will be generated:

ERROR: There is no currently selected printer driver.  Use Print Setup to select an installed printer driver.

ERROR: Internal error trying to set up “page i of n” processing.  Could be caused by out of memory, out of disk space, or internal coding error. Check for other error messages above indicating probable user error or resource constraints; if there are none, or if they make no sense, please report this message and provide a test program to SAS Institute. Output will continue without PAGEOF support.

A colleague had a newly refreshed PC, so I installed PC SAS and all of the EBI developer tools for him. I did not perform any customization to his SAS environment; I each developer is different so I let them tweak their own settings. It appears that I will need to begin to at least edit the sasv9.cfg file for all new developer SAS installations to include the following to prevent the errors:

-uprint
-uprintmenuswitch

In our case the sasv9.cfg file is located at
C:\Program Files\SASHome\x86\SASFoundation\9.3\nls\en\sasv9.cfg. The options we have to add turn on Universal Printing. What is that? Here is how SAS describes it:

What Is Universal Printing?

Universal Printing is a printing system that provides both interactive and batch printing capabilities to SAS applications and procedures on all operating environments that are supported by SAS. Universal Printing enables you to define printers and print previewers, and to control most printing options as your output is created. In addition to sending output to a printer, you can print to external files.

Windows Specifics: By default, the Windows operating environment uses Windows printing and not Universal Printing. For more information about using Universal Printing under Windows, see Setting Up the Universal Printing Interface and the Default Printing Environment.

SAS routes all printing through Universal Printing services. All Universal Printing features are controlled by system options, thereby enabling you to control many print features, even in batch mode. For more information about these system options, see System Options That Control Universal Printing.

Note: Before the introduction of Universal Printing, SAS supported a utility for print jobs known as Forms. Forms printing is still available if you select Filethen selectPrint Setup from the menu, then check the Use Forms check box. This turns off Universal Printing menus and functionality. For more information, see Forms Printing.

Setting Up the Universal Printing Interface and the Default Printing Environment

Universal Printing is enabled when SAS starts in the UNIX or z/OS operating environment. Under Windows, Windows printing is enabled when SAS starts. To use Universal Printing in Windows, you must set the UNIVERSALPRINT system option to enable the Universal Printing menus and dialog boxes, and to set up the printing defaults. This option can be set only in a SAS configuration file or at start-up. You cannot enable or disable Universal Printing menus and dialog boxes after SAS starts.

Windows Specifics: In the Windows operating environment, include the following system option when you start SAS:

-uprint

UPRINT is an alias for the UNIVERSALPRINT system option.

Note: When you use the PRINTERPATH= system option to specify a printer, the print job is controlled by Universal Printing. To return to Windows printing, set the PRINTERPATH= system option to a null string: PRINTERPATH=”.

We never saw these errors when developing in the Solaris or AIX environment because Universal Printing is turned on by default in those environments.

Leave a Reply

Your email address will not be published. Required fields are marked *