Pages

Monday, August 5, 2013

Widgets

Producing Enhanced HTML Reports using the ODS TABLEEDITOR Tagset


The ODS TABLEEDITOR tagset enables us to produce sophisticated HTML reports which exhibit similar characteristics to reports created using Microsoft Excel or Visual Basic .NET. The tagset can be downloaded from the ODS Markup Resources page on the SAS Support site in the form of a ZIP file which contains a host of examples along with the tagsets definition, saved in a TPL file. When extracted and submitted within SAS, this allows us to make use of the TABLEEDITOR tagset as an ODS destination.
This tip aims to demonstrate a couple of examples of using the TABLEEDITOR tagset to significantly enhance the presentation of HTML output.
In our first example the TABLEEDITOR tagset is used to generate HTML output with both autofilters and frozen headers activated. The autofilters have a default width uniformly assigned and have been defined for the first seven columns. Frozen headers have also been activated enabling us to scroll through the data listing whilst still being able to view column headings, in a similar fashion to Excel.
%inc 'tableeditor.tpl';
title "Listing of Product Sales";
ods listing close;
ods tagsets.tableeditor file="Sales_Report_1.html"
style=styles.meadow
options(autofilter="YES"
autofilter_table="1"
autofilter_width="6em"
autofilter_endcol= "7"
frozen_headers="YES"
frozen_rowheaders="YES"
) ;
proc print data=sashelp.prdsale noobs;
var year quarter month country region prodtype
product actual predict;
format actual predict nlmnlgbp12.2;
run;
ods tagsets.tableeditor close;
ods listing;
In order to view the resulting output it will be necessary to permit Internet Explorer to run Active X controls.
In our second example the TABLEEDITOR tagset is used to generate a HTML file with two reports, each of which is displayed on a separate tab which are named in the 'options' supplied on the opening ODS statement.
ods listing close;
ods noproctitle;
ods tagsets.tableeditor file="Sales_Report_2.html"
style=styles.meadow
options(web_tabs="First Report,Second Report");
title "Summary of product sales";
proc means data=sashelp.prdsale mean min max maxdec=2;
class prodtype product;
var actual predict;
run;
title "Mean product sales by country";
proc tabulate data=sashelp.prdsale format=nlmnlgbp12.2;
class prodtype product country;
var actual predict;
table prodtype*product,country*(actual*mean=''
predict*mean='');
run;
ods tagsets.tableeditor close;
ods listing;

No comments:

Post a Comment