GENERATING SAS HARD COpy OUTPUT UNDER THE VMS N VAX ENVIRONMENT Edmond Williams, Consultant Shi-Tao Yeh, Consultant Abstract SAS output, the result of executing SAS programs, is in the form of text output or graphs. Routing the SAS output to different devices in the network and VMS VAX envirorunent is not a easy task. This paper discusses how to redirect SAS procedure output to the printer and plotter in the VMS network environment. Several methods are examined: o Routing output to the printer from the OUTPUT Window, o Sending output to the printer directly from a batch SAS job, o Sending graphic output to the printer or plotter. This paper provides sample SAS code for each method discussed. Device Name HP7550A HPU3SI VT240 GraphOn PC-Monitor.. n HP7S50A Graphics Plotter HP Laser Jet m Si DECVT240 Terminal GraphOn250 Terminal PC-Monitor with Communication Software I. Introduction As the network and VAX environment increases in size on the industrial and goverrunent front, so has the need for 'tried and true' output pathways. With the advent of pmenus and SCL it is desirable to generate output from within the application. The VAX envirorunent discussed is a typical. The users are on VAX VMS with access to the printers and plotter by means of the network. This hypothetical VAX multi-user system contains the devices shown in Table 1. II. Routing Output to the Printer from the Output Window The SAS Display Manager System is an interactive fu1l-screen windowing environment, as affording users to view and operate the SAS system from a series of windows. The three main windows are the Program Editor, Log, OutnutTvoe Graph GrapblText GrapblText GrapbIText GrapbIText,Nllme Q9 Q2 NA NA NA Table 1. V AX Multi-User Network System 665
and Output. The default destination for SAS output on display manager mode is the OUTPUT window. There are two methods to send the SAS output to the printer from OUTPUT window; X command method, and PRTFlLElPRINT method. 2.1 X Command Method The X command temporarily exits the SAS Display Manager to the host system and it is executed immediately. This method involves two steps: 1) save the output file as external file by issue the Fll..E command in the command line; 2) issue an X command to send the file to the printer. The following OUTPUT SAS window display shows an example utilizing the X command. The X command contains the Vax VMS net work printing command OUTPUT, which is preferred over the PRINT command. The /queue is a queue type/class and may be anyone of the following: DP, HQ, SP, LOCAL. The OUTPUT command is capable of handling three types of outputs. DP HQ SP LOCAL Bulk heavy duty Data Processing printing; High Quality font intensive printing; SPecial graphical printing; This type is not really a class of printing, however. LOCAL printing would tend to be short printouts. LOCAL is routed to your local printer (the printer attached to your terminal). In the recent example the type/class of printout was not specified, therefore the default was taken. In most cases the default is type DP. The target printer may be capable of handling any combination of these three type of printing. To inquire of _ the system assignments simply issue the command: OUTPUTILIST The system will list all the printer found on the network along with the type of printouts that they can handle. To obtain a list of printers that handle a specific type/class do the following: OUTPUT Command > file 'myfile.ouf; X 'outputlqueue=q2 myjile.ouf 0 P I B I N S D C 1 00001 American Fed. 2 00002 British Liners 3 00003 Goal Chemical Figure 1. Example of X comnumd in the OUTPUT window 666
OUTPUTILIST=rype filename myoutput printer queue=q2; where type is either DP, HQ, SP, or LOCAL. 2.2 PRTFILEIPRINT Method other SAS statements; You can issue a PRINT command from the OUTPUT window's command line to send the contents of OUTPUT window to the default printer. You can reroute the output to a printer queue other than the default by adding the following FILENAME and PRTFILE statements to your SAS program. dm output 'prtfile myoutpuf output; You can issue a PRINT command from the OUTPUT window command line to send the output to the printer queue=q2. OUTPUT Command => Print ODS 1 2 SUBJECT 1209 3045 The SAS System NAME Janet Joplin Joan Jet LOG Command=> filename myoutput printer queue=q2; other SAS statements; r"",~ 2. Extlmpk 0/ PRINT co1lulul1ldftom tlte OUTPUT willdow 667
III. Sending Output to the Printer Directly from a Batch SAS Job The PRINTTO statement defines destinations for the SAS procedure output. The following statements send any SAS output generated after the RUN statement to the printer queue=q2. filename myoutput printer queue=q2; proc printto print = myoutput new; other SAS statements; proc printt; A PROC PRINTTO statement with no options follows the above block of SAS statements. It performs two functions: 1) start the print job at printer queue, 2) redirect the SAS log and procedure output to the original default destinations. IV. Sending Graphic Output to the Printer or Plotter You need to create a graphic stream tile (GSF) before sending graphic output to the printer/plotter queue. GSFs are used to capture data streams in the form in which they are sent to a graphic device. A GOPTION statement, including options of DEVICE, GSFMODE, GSFNAME, and NODISPLA Y, controls whether and how the GSF is generated. The option of GSFMODE specifies whether or not to send graphics output to a GSF and GSFNAME specifies the name of a file to which GSF data streams are written. The following example demonstrates the utilization of the goptions and X statement to initiate printing from the SAS environment to a HP7550A plotter: goption DEVICE = hp7550a GSFMODE = append GSFNAME = gsf NODISPLAY; filename gsf 'testpl.gsf; proc gtestit; quit; x 'OUTPUT/SP=q9 testplgsf; ~arger HP laser printers allow the assignment of either DP, HQ, or SP' in the OUTPUT command, while smaller printer may only allow HQ or SP. Use the class SP when sending graphics to the plotter. Beware of the default printing mode of your printer. Some HP laser printers have a default printing ;node of postscript (PS), some other HP Laser printers have a default mode of printer control language (PCL). If you are utilizing a driver for PS and the printer is in the PCL mode or visa versa, you will receive warped output, garbage. Usually, drivers which are prefixed by the letters PS are postscript drivers; driver prefixed by HP are pel drivers. You may obtain a complete list of the drivers available to your installation by running proc gdevice. At our installation I find device driver PSLMONO sufficient for postscript devices and HPGL3 SI adequate for the printer in pel mode. 668
Goptions colors = ( black) device = hpgl3si gsfinode = replace gsflen= 132 gsfuame = gsf nodisplay; filename gsf'test.gs '; title 'Anything'; proc gslide; note height = 5 font = swissb justify = center 'test'; quit; filename gsf clear; x 'output!sp=q2/parameter =(data type=hppcj) test.gs '; There are, however, ways to change the mode of the printer utilizing software or vax commands. The following example demonstrates a PS default mode set printer, where the user wishes to utilize the PCL driver, HPGL3 SI. Here the PARAMETER parameter DATA_TYPE=HPPCL softsets the HP printer located at Q2 to the PCL mode. Upon completion of the printer queue job the printer will return to the default mode, in this case PS. If the situation is reversed, where we would have a Postscript capable printer in PCL mode, you may specify the parameter DATA_TYPE=POSTCRIPT. v. Incorperating PRCO GREPLAY to be Green In recent history concern over the eclogical health care of this small blue planet has become paromont. Overwhelmed by the scope of the problem, athorities and experts have simply asked earthlings to do their small part. As responable SAS programmers we can save yet another forest by utilizing PROC GREPLAY. Unfortunitly, you must either be connected directly to the V AX via a VAX compatable terminal, or, for PC users, you must be using some network software where graphics are enabled. If you are in a situation where graphics are disabled, you might want to seek your technical staff. Many times these options for enableingldisabling can be controled locally. In rare cases where graphic emulation is unobtainable due to a lack of options in the vendors software, see your supervisor/manager and advise himlher to drop that vendor; there are many vendors on the market that offer graphics emulation capabilities. PROC GREPLAY allows the user the ability to preview graphics output on screen before printing. The following demonstrates the basic green attribute ofproc GREPLA Y. Goptions Targetdevice = Pslmono device = vt330 device = hpgl3si gsfinode = replace gsflen= 132 gsfuame = gsf nodisplay; filename gsf'test.gsf; title 'Anything'; proc gslide; note height = 5 font = swissb justi.ty = center 'test'; quit; filename gsf clear, x 'outputlsp=q2iparameter =(data type=hppcl) test.gst'; 669
options implmac ; %maero Likeit( f1_ume = test,g..iname = sasgout,devdame = pslmono, devlen = 132, ILqueue = ) I stmt ; %* Macro : LIKE IT (graphics display). * Description: This macro, when utilized in conjunction with the * DEVICE and TARGETDEVICE options, allow the user the reasonable opportunity to rout the output send on the * screen to the printer. * Remarks : This macro can only be ejteetive if run immediately * following the graph created 00 the screen utilizing the GOUT option. %* - Parameters - *...graphic FiLe NAME(it will be a.pf type me). * Graphics Input rde NAME. *..graphics output DEVice NAME. * _.output DEVice line LENgth. *._Graphics vax printer QUEUE. % * Declarations %Ioeal answer 1* _User response to the print question.*1 %* - Main Code- * Derme display printer query window. * Display window. * Was the print response positive? %window doit #05 @05 "File name : " #05 @40 "Input graph eat :" #06 @05 "Device name : " #06 @40 "Device length :.. m @OS "Graph print queue:.. #20 @OS "Print{<Y>/N]?" @25 II name 13 @61 gjuame 20 @25 devname 15 @61devlen3 @2SlLqueue 30 @19answer 1 %display doit; %if %upease( &answer) eq Y %then %do; %* Yes, the print response was positive. * Output the displayed information to the printer. goption gsfmode = append %if %str( &devname ) ae %ser( ) % then device = &devname; %if %str( &devlea) ae %str() %thed gsfiea = &devlen; gsfname = gsf autofeed rdename asf..&n_ name gsf"; proc greplay nofs igout = &1_ iname replay _Iast_; rud; quit; filename gsf clear; X "outputlsp=&1l queue &0_ name..gsf"; %end; %mend likeit; Goptions Targetdevice = Pslmono device = vt330 gsfmode = replace gsflen = 132 gsfname = gsf; filename gsf 'test.gsf'; title 'Anything'; proc gsjide; note height = 5 font = swissb justify = center 'test'; quit; filename gsf clear; likeit g queue = 790; reqwred=yes required=yes 670
Conclusion This paper discussed how to send SAS procedure output to the printer or plotter in the VMS network environment with sample SAS code provided. The following methods have been discussed: 1) Routing output to the printer from the OUTPUT window. 2) Sending output to the printer directly from a batch SAS job. 3) Sending graphic output to the printer or plotter. References SAS Institute Inc., (1990), SAS Companion/or the VMS Environment, Version 6, SAS Institute Inc., Cary, NC. SAS is a registered trademark or trademark of SAS Institute Inc., in the USA and other countries. ~ indicates USA registration. VMS is a trademark of Digital Equipment Corporation. The sample code provides a handy tip to SAS users who need to deal with the same task. 671