Published on :
Reporting SASHELP

Creating Composite Dashboards with ODS HTMLPANEL

This code is also available in: Deutsch Español Français
Awaiting validation
This script illustrates the creation of complex layouts (dashboards) using `ods tagsets.htmlpanel`. It demonstrates how to nest panel events (rows and columns) to position multiple graphic outputs (pie charts, geographical maps) and tabular outputs side-by-side. The code uses historical SAS©/GRAPH procedures (GCHART, GMAP).
Data Analysis

Type : SASHELP


Uses the standard `sashelp.class` table for statistical data and the `maps.us` table for mapping data.

1 Code Block
INITIALIZATION
Explanation :
Initialization of global graphic options and opening of the ODS HTMLPANEL destination for the creation of the 'composite.html' file.
Copied!
1%let panelborder=1;
2goptions reset=all dev=java;
3ods tagsets.htmlpanel path="." (url=none) file="composite.html" style=default;
4 
5title1 "This is a graph panel title";
6title2 "with a sub-title below it";
7footnote1 "This is a panel footnote";
8footnote2 "along with a sub-footnote";
2 Code Block
ODS LAYOUT
Explanation :
Start of a row panel and a first column. Generation of two pie charts (Age vs Height/Weight) vertically stacked in this first cell.
Copied!
1/* Start a row panel, with a column panel in the first cell */
2ods tagsets.htmlpanel event=row_panel(start);
3 
4/* Cell 1 */
5ods tagsets.htmlpanel event=column_panel(start);
6 
7goptions xpixels=240 ypixels=240;
8PROC GCHART DATA=sashelp.class;
9 pie age / sumvar=height;
10RUN;
11QUIT;
12 
13PROC GCHART DATA=sashelp.class;
14 pie age / sumvar=weight;
15RUN;
16QUIT;
17 
18/* Close the column panel */
19ods tagsets.htmlpanel event=column_panel(finish);
3 Code Block
PROC GMAP
Explanation :
Generation of a choropleth map of the United States in the second cell (implicit central column or continuation of the flow) with higher resolution.
Copied!
1/* Cell 2 */
2goptions xpixels=480 ypixels=480;
3PROC GMAP map=maps.us DATA=maps.us;
4 id state;
5 choro state;
6RUN;
7QUIT;
4 Code Block
PROC GCHART
Explanation :
Creation of a third column containing two other pie charts based on the mean. Closing of the column and the global row.
Copied!
1/* Cell 3 */
2ods tagsets.htmlpanel event=column_panel(start);
3goptions xpixels=240 ypixels=240;
4PROC GCHART DATA=sashelp.class;
5 pie age / sumvar=height type=mean;
6RUN;
7QUIT;
8 
9PROC GCHART DATA=sashelp.class;
10 pie age / sumvar=weight type=mean;
11RUN;
12QUIT;
13 
14/* Close the column panel */
15ods tagsets.htmlpanel event=column_panel(finish);
16/* Close the whole panel */
17ods tagsets.htmlpanel event=row_panel(finish);
5 Code Block
PROC SORT Data
Explanation :
Sorting of `sashelp.class` data by sex and age, stored in a temporary table `temp`.
Copied!
1title1 "This is a table example";
2goptions xpixels=340 ypixels=335;
3PROC SORT DATA=sashelp.class out=temp;
4 BY sex age;
5RUN;
6 Code Block
ODS LAYOUT MIXTE
Explanation :
Creation of a second composite panel combining a horizontal bar chart (HBAR) in the first column and a data table (PROC PRINT) in the second. Closing of all ODS destinations.
Copied!
1/* Start a row panel, with a column panel in the first cell */
2ods tagsets.htmlpanel event=row_panel(start);
3 
4/* Cell 1 */
5ods tagsets.htmlpanel event=column_panel(start);
6PROC GCHART DATA=temp;
7 BY sex;
8 hbar age / discrete sumvar=weight type=mean;
9RUN;
10QUIT;
11 
12/* Close the column panel */
13ods tagsets.htmlpanel event=column_panel(finish);
14 
15/* Cell 2 */
16PROC PRINT DATA=temp;
17RUN;
18QUIT;
19 
20/* Close the whole panel */
21ods tagsets.htmlpanel event=row_panel(finish);
22 
23ods _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.