SAS/IntrNet 8.2: Application Dispatcher |
This sample illustrates how to produce graphics output by using the Application Dispatcher. It requires that you have SAS/GRAPH software licensed and installed.
The HTML page for this sample application provides the most essential information. To keep the program code simple, the only variables that have been used are the _SERVICE, _PROGRAM, and _DEBUG Dispatcher variables. Because none of these values dynamically change the program code, every invocation of this application produces the same graphic. The purpose of this sample is to provide a simple "how to" explanation for creating graphics.
The HTML code for this application is installed with the Dispatcher package in a default location at http://yourserver/sasweb/IntrNet8/dispatch/webgraph.html. The code produces a form that similar to this:
The following describes the steps performed by a Dispatcher program
Here is the complete code for this Dispatcher program.
data _null_; file _webout; put 'Content-type: image/gif'; put; run; goptions gsfname=_webout gsfmode=replace dev=gif733 ftext=swiss; pattern1 value=solid color=yellow; pattern2 value=solid color=cyan; pattern3 value=solid color=green; pattern4 value=solid color=black; pattern5 value=solid color=red; pattern6 value=solid color=blue; proc gchart data=sashelp.retail; pie year/sumvar=sales; pattern v=s; run; quit;
The resulting graphic is a pie chart of the sashelp.retail data set. The
gsfname
option directs the SAS/GRAPH procedure to write the
image output to the special fileref and back to the Web browser. Notice
the gsfmode=replace
option. This is very important. It is tempting
to use an append mode here because you have already written to a header in
the previous DATA step. Don't use the append mode. A gsfmode of replace must
always be used, otherwise the procedure may skip writing out some critical GIF
initialization information.
It is impossible to overwrite data already sent to _WEBOUT. Because the Application Dispatcher uses TCP/IP sockets to flow the data from your program to the Web browser, the _WEBOUT fileref is always appending. As with standard output and pipes, _WEBOUT cannot replace what has been previously written.
SAS/IntrNet 8.2: Application Dispatcher |