Previous Page | Next Page

Examples Using Compute Services

Example 9: Graphics Processing on the Server


Purpose

If the SAS/GRAPH software is installed on the client and server computers, you can submit graphics programs from your client session to a server session, execute the procedure in the server session, and display the graphics output in the client session (or on a device that is attached to your client computer). This link is especially useful when you want to generate graphics in your client session by using a large database that is accessible from the server session.

The GRLINK driver is a special driver that is available with SAS/CONNECT. You must always use the GRLINK driver in the server session when using the link to display server machine graphics in your client session.

If you frequently use the link for server graphics processing, consider specifying the GRLINK device driver in a script file (if you use a script file with the SIGNON command). To do this, include the driver specification for the server computer in the TYPE statement that invokes the server session.

In this program, if you use TSO via TCP/IP, change the TYPE statement in the script file to the following code:

type 
"sas options('comamid=tcp device=grlink dmr')";

By changing the TYPE statement in the script file each time that you use the SIGNON command, you automatically specify the GRLINK driver in the server session. The GRLINK driver is specified in the sample scripts that are provided with your SAS software.

This program uses the RSUBMIT statement to submit SAS statements, which include any LIBNAME statements that are needed in the server session. When the SAS/GRAPH procedure runs in the server session, the output is displayed at the client session or on an attached device (based on the driver that you specified in your client session). Be sure to specify the GOPTIONS DEVICE=GRLINK driver as shown in step 3.


Program

1  goptions device='';

2  rsubmit;

   proc sort data=master.bg_reserve out=tmp;
      by origin rental_type;
   run;

   proc summary data=tmp vardef=n noprint;
      by origin rental_type;
      output out=temp_rental;
   run;

3  goptions device=grlink ftitle=centx 
   ftext=simplex htitle=2;

   title 'Rental Types by Franchise';
   pattern value=solid color=blue;

   axis1 label=('Franchise')
   order=
   ('ATLANTA' 'CHICAGO' 'LOS ANGELES' 
      'NEW YORK' 'TORONTO')
   width=3;
   axis2 label=none width=3;
   axis3 label=none 
   order=0 to 1000 by 100 width=3;
   proc gchart data=temp_rental;
      label rental_type='00'x;
      label origin='00'x;
      hbar rental_type /  frame
      sumvar= _freq_
      maxis=axis2
      raxis=axis3
      minor=0
      nostats
      group=origin
      gaxis=axis1
      discrete;
   run;
   quit;

endrsubmit;

[1] Specifies an EGA graphics adapter to display the server session graph in your client session. You can specify the name of the graphics driver for your client computer or its attached hard-copy device. For a complete list of values for the DEVICE= option, run the GDEVICE procedure in your client session. This example sets the device option to a null value so that the default device will be used.

Note:   A null value is specified by using two single quotation marks.  [cautionend]

[2] Remotely submits procedures to preprocess data and graphics procedures in the server session.

[3] Specifies the GRLINK device driver so that commands to draw the graph will be sent to the client session.

When using the link to display server session graphs, you can use any graphics procedure on the server (including the GREPLAY procedure) and any graphics device driver on the client.

The GRLINK server computer driver uses the attributes of the driver that is specified in the client session when selecting default colors, character sizes, and other attributes. For example, if you specify DEVICE=PSCOLOR in your client session, the GRLINK driver uses the default colors of the PSCOLOR driver, but if you specify the printer driver DEVICE=PCL5 in your client session, the GRLINK driver uses only black as a foreground color.

Note these reminders when using the link for graphics:

You can also transfer catalog entries that contain graphics output by using the UPLOAD and DOWNLOAD procedures, as described in Example 3.4: Using the ENTRYTYPE= Option in Two SELECT Statements in PROC DOWNLOAD.

Previous Page | Next Page | Top of Page