Published on :
Reporting SASHELP

Combined Chart with GBARLINE

This code is also available in: Deutsch Español Français
The script uses `goptions` to initialize graphics parameters. It opens an ODS HTML destination to save the graphical output to a `test.html` file. `PROC GBARLINE` is then used to create a chart overlaying bars (`product` by `sumvar=actual`) and a line (`sumvar=predict`). Finally, the ODS HTML destination is closed, completing the creation of the output file.
Data Analysis

Type : SASHELP


The data comes from the SASHELP library, specifically from the `PRDSALE` table, which contains product sales information.

1 Code Block
OPTIONS / ODS
Explanation :
This block initializes the graphics options by resetting all parameters and specifying the ActiveX graphics device. It then configures the ODS HTML destination to save the graphical output to the `c:\workshop\hw06\test.html` file.
Copied!
1goptions reset=all device=activex ;
2 
3ods html file='c:\workshop\hw06\test.html' ;
4 
2 Code Block
PROC GBARLINE
Explanation :
This block uses `PROC GBARLINE` to create a combined chart. It takes data from the `sashelp.prdsale` table. The `bar product / sumvar=actual` clause generates a bar chart where each bar represents a `product` and its height is the sum of the `actual` variable. The `plot / sumvar=predict` clause overlays a line on the same chart, representing the sum of the `predict` variable.
Copied!
1PROC GBARLINE DATA=sashelp.prdsale;
2 bar product / sumvar=actual ;
3 plot / sumvar=predict ;
4RUN; QUIT;
3 Code Block
ODS
Explanation :
This block closes the previously opened ODS HTML destination, which finalizes the writing of the HTML file containing the chart.
Copied!
1ods html 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.