SAS Institute. The Power to Know

SAS(R) 9.2 Publishing Framework: Developer's Guide

Previous Page | Next Page

Viewer Processing

Sample 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.

The following code shows the viewer properties and attributes:

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 the output from the viewer coding sections that are described in How to Create a Viewer. The e-mail output from this sample HTML viewer is a collection of the output from these sections.

Previous Page | Next Page | Top of Page