The script begins by configuring graphics options and initial ODS TAGSETS.HTMLPANEL settings, including the HTML file destination and the number of columns for the panels. It then executes several PROC PRINT statements on the SASHELP.CLASS table, grouped into panels. Panel options are modified during execution. A PROC SORT is used to sort SASHELP.CLASS by age, creating a new temporary table, which is then visualized with PROC GCHART to display the sum of weight relative to height, grouped by age. The script concludes by closing all ODS destinations.
Data Analysis
Type : SASHELP
The script exclusively uses the SASHELP.CLASS table, a standard demonstration table built into SAS, and creates a temporary table 'WORK.FOO' from it for sorting and graphing operations.
1 Code Block
GOPTIONS & ODS HTMLPANEL Setup
Explanation : Configures graphics options for GIF output with specified dimensions. Initializes the ODS TAGSETS.HTMLPANEL destination to create a paginated HTML report with panels, defining the output file ('printpanel2.html') and several panel display options such as the number of columns, borders, and title management.
Explanation : Starts a new group of ODS HTML panels. Three consecutive PROC PRINT statements are executed on the SASHELP.CLASS table, each preceded by a distinct title. Each PROC PRINT output is encapsulated in a separate panel. The panel group is then closed.
Copied!
/* start the panelling */
ods tagsets.htmlpanel event = panel(start);
title 'First proc Print';
proc print data=sashelp.class;run;
title 'Second proc Print';
proc print data=sashelp.class;run;
title 'Third proc Print';
proc print data=sashelp.class;run;
/* Stop the current Panel */
ods tagsets.htmlpanel event = panel(finish);
1
/* start the panelling */
2
3
ods tagsets.htmlpanel event = panel(start);
4
5
title 'First proc Print';
6
7
PROC PRINTDATA=sashelp.class;RUN;
8
9
title 'Second proc Print';
10
PROC PRINTDATA=sashelp.class;RUN;
11
12
title 'Third proc Print';
13
PROC PRINTDATA=sashelp.class;RUN;
14
15
16
/* Stop the current Panel */
17
ods tagsets.htmlpanel event = panel(finish);
3 Code Block
PROC SORT & PROC GCHART Data
Explanation : Modifies HTML panel options, reducing the number of columns to 2 and disabling embedded titles. The SASHELP.CLASS table is sorted by the 'age' variable and the result is saved in a new temporary table named 'foo'. Then, PROC GCHART generates a horizontal bar chart from the 'foo' table, grouped by 'age', displaying the sum of 'height' by 'weight'.
Copied!
/* Change the panel settings */
ods tagsets.htmlpanel options(panelcolumns='2'
embedded_titles='no');
/* this bygroup get's a panel of it's own. */
title ;
proc sort data=sashelp.class out=foo;
by age;
run;
proc gchart data=foo;
by age;
hbar weight / sumvar=height;
run;
quit;
1
/* Change the panel settings */
2
3
ods tagsets.htmlpanel options(panelcolumns='2'
4
embedded_titles='no');
5
6
/* this bygroup get's a panel of it's own. */
7
8
title ;
9
10
PROC SORTDATA=sashelp.class out=foo;
11
BY age;
12
RUN;
13
14
PROC GCHARTDATA=foo;
15
BY age;
16
hbar weight / sumvar=height;
17
RUN;
18
QUIT;
4 Code Block
PROC PRINT
Explanation : Starts a new group of ODS HTML panels. Two more PROC PRINT statements for SASHELP.CLASS are executed. The first has a simple title, while the second includes both a title and a footnote. The panel group is then closed.
Copied!
/* start a new, semi-automatic panel */
ods tagsets.htmlpanel event = panel(start);
title 'Fourth proc Print';
proc print data=sashelp.class;run;
title 'Fifth proc Print';
Footnote 'End of Fifth proc Print';
proc print data=sashelp.class;run;
ods tagsets.htmlpanel event = panel(finish);
1
/* start a new, semi-automatic panel */
2
ods tagsets.htmlpanel event = panel(start);
3
4
title 'Fourth proc Print';
5
PROC PRINTDATA=sashelp.class;RUN;
6
7
title 'Fifth proc Print';
8
Footnote 'End of Fifth proc Print';
9
PROC PRINTDATA=sashelp.class;RUN;
10
11
ods tagsets.htmlpanel event = panel(finish);
5 Code Block
ODS Closure
Explanation : Closes all ODS destinations that were opened during script execution, ensuring output files are finalized.
Copied!
ods _all_ close;
1
ods _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.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.