Published on :
Reporting SASHELP

Multi-Panel HTML Reports with ODS Tagsets

This code is also available in: Deutsch Español Français
Awaiting validation
This script illustrates the use of the 'htmlpanel' tagset to create advanced layouts. It aggregates data from SASHELP.SHOES to produce reports by region and product, then by region and subsidiary. The result includes bar charts, a data table, and pie charts, dynamically arranged across multiple columns.
Data Analysis

Type : SASHELP


Use of the standard SASHELP.SHOES table. Work tables (sum) are derived from it.

1 Code Block
ODS / GOPTIONS
Explanation :
Configuration of the ODS layout (4 columns) and Java graphics options. Note: Paths are Windows-specific.
Copied!
1%let panelcolumns = 4;
2%let panelborder = 4;
3ods tagsets.htmlpanel file="C:\workshop\hw06\bypanel2.html" gpath='c:\workshop\hw06\' options(doc='help');
4goptions device=java xpixels=320 ypixels=240;
2 Code Block
PROC SUMMARY Data
Explanation :
Aggregation of data by region and product to calculate sums and means.
Copied!
1title1 'Product Reports' ;
2footnote1 ;
3PROC SUMMARY DATA=sashelp.shoes nway ;
4 class region product ;
5 var stores sales inventory returns ;
6 OUTPUT out=sum sum= mean= /autolabel autoname ;
7RUN ;
3 Code Block
PROC GCHART
Explanation :
Generation of vertical bar charts (sales by product) for each region.
Copied!
1PROC GCHART DATA=sum ;
2 BY region ;
3 vbar product / sumvar=sales_sum pattid=midpoint discrete ;
4RUN;
5QUIT;
4 Code Block
PROC SUMMARY Data
Explanation :
Second aggregation of data, this time by region and subsidiary.
Copied!
1PROC SUMMARY DATA=sashelp.shoes nway ;
2 class region subsidiary ;
3 var stores sales inventory returns ;
4 OUTPUT out=sum sum= mean= /autolabel autoname ;
5RUN ;
5 Code Block
PROC PRINT
Explanation :
Modification of the ODS layout (5 columns) and display of aggregated data as a table.
Copied!
1%let panelcolumns = 5;
2%let panelborder = 1;
3ods tagsets.htmlpanel ;
4 
5title 'Summary data' ;
6PROC PRINT DATA=sum ;
7RUN ;
6 Code Block
PROC GCHART
Explanation :
Generation of pie charts (sales by subsidiary) for each region and closing of ODS destinations.
Copied!
1title 'Subsidiary Reports' ;
2%let panelcolumns = 5;
3%let panelborder = 1;
4ods tagsets.htmlpanel ;
5goptions dev=java xpixels=160 ypixels=120;
6PROC GCHART DATA=sum ;
7 BY region ;
8 pie subsidiary / sumvar=sales_sum discrete ;
9RUN;
10QUIT;
11ods _all_ close;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.