Symbols passed to SAS
#symbols: 20
"_SRVNAME" = "hunding"
"_SRVPORT" = "80"
"_REQMETH" = "GET"
"_RMTHOST" = "192.168.2.101"
"_RMTADDR" = "192.168.2.101"
"_RMTUSER" = ""
"_HTCOOK" = ""
"_HTUA" = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.7.12) Gecko/20050915 Firefox/1.0.7"
"_mrvimg" = "/sasweb/IntrNet9/MRV/images"
"_grfaplt" = "/sasweb/graph/graphapp.jar"
"_grafloc" = "/sasweb/graph"
"_service" = "default"
"_program" = "examples.webhello.sas"
"_debug" = "131"
"_VERSION" = "9.1"
"_URL" = "/scripts/broker.exe"
"_ADMIN" = "Your Name"
"_ADMAIL" = "yourname@yoursite"
"_SERVER" = "hunding"
"_PORT" = "5001"
Using timeout: 60
Content-type: text/html Pragma: no-cache Content-type:
text/html Hello World!
Sas Log for this Request
NOTE: running request program examples.webhello.sas
NOTE: %INCLUDE (level 1) file
c:\Inetpub\scripts\examples\webhello.sas is file c:\Inetpub\scripts\examples\webhello.sas.
2 + /********************************************************/
3 + /* S A S S A M P L E L I B R A R Y */
4 + /* */
5 + /* NAME: WEBHELLO */
6 + /* TITLE: Hello World */
7 + /* PRODUCT: SAS/IntrNet (Application Dispatcher) */
8 + /* SYSTEM: ALL */
9 + /* KEYS: */
10 + /* PROCS: */
11 + /* DATA: */
12 + /* */
13 + /* SUPPORT: Web Tools Group UPDATE: 13Oct2000 */
14 + /* REF: http://support.sas.com/rnd/web/IntrNet/dispatch/*/
15 + /* MISC: */
16 +/*********************************************************/
17 +
18 + /*simply write out a web page that says "Hello World!" */
19 +data _null_;
20 + file _webout;
21 + put '<HTML>';
22 + put '<HEAD><TITLE>Hello World!</TITLE></HEAD>';
23 + put '<BODY>';
24 + put '<H1>Hello World!</H1>';
25 + put '</BODY>';
26 + put '</HTML>';
27 +run;
NOTE: The file _WEBOUT is:
Access Method=Application Server Access Method, Network connection type=Full Duplex,
Peer IP address=192.168.2.102
NOTE: 6 records were written to the file _WEBOUT.
The minimum record length was 6.
The maximum record length was 40.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds cpu time 0.00 seconds
NOTE: %INCLUDE (level 1) ending.
NOTE: request has completed
This request took 0.11 seconds of real time (v9.1 build 1461).
The SAS Application Dispatcher documentation suggests setting some of these flags off in production environments so that users will not have access to the information. This is accomplished by using the DebugMask and ServiceDebugMask directives in the file broker.cfg (see http://support.sas.com/rnd/web/intrnet/dispatch/debuginp.html).
Generating Dynamic Output with the Output Delivery System
Most users are going to want to use SAS procedures to display output, rather than PUT statements. There are two ways to accomplish this: using the old SAS 6 Web Publishing Tools or the Output Delivery System. (See “The Program Component” at
http://support.sas.com/rnd/web/Intrnet/dispatch/procomp.html for more detail on writing SAS programs for the Application Dispatcher.)
As the discussion in Chapter 3, “Creating Static HTML Output,” suggests, ODS is the preferred approach. The following simple example shows how to create a Web page containing a table based on the current values stored in a SAS data set; the example is simplified from the Application Dispatcher samples available with the default
SAS/IntrNet installation. (You can get more information on this and the other Application Dispatcher examples at
http://support.sas.com/rnd/web/intrnet/dispatch/sampapp.html.)
The output of the REPORT procedure is directed to the Application Dispatcher using ODS, which sends the HTML output, created by the HTML3 destination, to the file reference _webout.
Chapter 6 SAS/IntrNet: the Application Dispatcher 123
Example 6.4 Using ODS to Display Procedure Output
%* Sales report Example - Display Product by Region;
%macro salesrpt;
%global region;
proc report data=sashelp.shoes;
by region;
%if (®ion ne ) %then %do;
where region="®ion";
%end;
title "Sales by Product";
footnote "Data are current as of &systime &sysdate9";
column product sales;
define product / group;
define sales / analysis sum;
quit;
%mend salesrpt;
/* redirect output to client */
ods html3 body=_webout;
%salesrpt
There are a couple of simple tricks in this program. The SAS macro variables
SYSDATE9 and SYSTIME are used to display the date and time the program is run. In order to ensure that the program does not fail if the user leaves off the REGION
parameter, the macro variable is initialized with a %GLOBAL statement; if no region is specified, the default is to display all of the data.
The URL for this page illustrates the three name/value pairs required to call the sample program for the region “Africa”; the output is shown in Display 6.12.
http://hunding/scripts/broker.exe?
_service=default&_program=examples.example6-4.sas&
region=Africa
Note that this example uses the html3 output destination. The SAS Notes indicate that the Application Server may crash if you use ODS and do not properly close the listing;
see http://support.sas.com/techsup/unotes/SN/011/011595.html.