|
Publishing Framework
SAS Program with an HTML ViewerThe following SAS program example includes two parts:
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.
|