SAS 9.1.3 Integration Technologies » Developer's Guide


Viewer Processing
Usage
When to Use a Viewer
How to Create a Viewer
How to Apply a Viewer
Reference
SASINSERT Tag
Substitution Syntax
SASTABLE Tag
SASREPEAT Tag
SASECHO Tag
Examples
Using the SASINSERT and SASTABLE Tags
Sample HTML Viewer
SAS Program with an HTML Viewer
Sample Viewer Template
Publishing Framework

SAS Program with an HTML Viewer

The following SAS program example includes two parts:

  • SAS code that creates two SAS data sets
  • Package publishing CALL routines that create a package, insert package entries, and publish the package to e-mail with the aid of a viewer file.

The PACKAGE_PUBLISH CALL routine applies a viewer that is named realview.html to the package that is rendered in e-mail.

See the viewer properties and attributes that are set in bold in the code below.

   data empInfo;
   length homePage $256;
   input fname $ lname $ ages state $ siblings homePage $;
   datalines;
   John Smith 32 NY 4    http://alphaliteairways.com/~jsmith
   Gary DeStephano  20  NY 2 http://alphaliteairways.com/~gdest
   Arthur Allen  40  CA 2 http://alphaliteairways.com/~aallen
   Jean Forest 3   CA 1    http://alphaliteairways.com/~jforest
   Tony Votta  30  NC 2 http://www.pizza.com/~tova
   Dakota Smith 3   NC 1   http://~alphaliteairways.com/~dakota
   ;
   run;
   quit;

   data fileInfo;
   length fileName $256;
   input fileName $;
   datalines;
   Sales
   Marketing
   R&D
   ;
   run;
   quit;

   data _null_;
   rc=0; pid = 0;

   call package_begin(pid,"Daily Orders Report.",'', rc);
   if (rc eq 0) then put 'Package begin successful.';
   else do;
      msg = sysmsg();
      put msg;
   end;

   call insert_ref(pid, "HTML", 
      "http://www.alphaliteairways.com", 
   "Check out the Alphalite Airways Web site 
      for more information." , "", rc);
   if (rc eq 0) then put 'Insert Reference successful.';
   else do;
      msg = sysmsg();
      put msg;
   end;

   call insert_dataset(pid, "work", "empInfo", 
      "Data Set empInfo" , "", rc);
   if (rc eq 0) then put 'Insert Data Set successful.';
   else do;
      msg = sysmsg();
      put msg;
   end;

   call insert_dataset(pid, "work", "fileInfo", 
      "Data Set fileInfo" , "", rc);
   if (rc eq 0) then put 'Insert Data Set successful.';
   else do;
      msg = sysmsg();
      put msg;
   end;

   viewerName='filename:realview.html';
   prop='VIEWER_NAME';
   address="John.Smith@alphaliteairways.com";
   call package_publish(pid, "TO_EMAIL", rc, 
      prop, viewerName, address);
   if rc ne 0 then  do;
      msg = sysmsg();
      put msg;
   end;
   else
      put 'Publish successful';

   call package_end(pid,rc);
   if rc ne 0 then  do;
      msg = sysmsg();
      put msg;
   end;
   else
      put 'Package termination successful';

   run;

To look at the content of the viewer template, see Sample Viewer Template.

To look at a rendered view of the package that is delivered to e-mail, see Simulated Rendered View of the Package in E-mail.