Sample 44184: Add a gradient shaded background to SAS/GRAPH® output
This sample code demonstrates how to add a gradient shaded background to SAS/GRAPH® output. The code first uses PROC TEMPLATE code to create a custom style called STYLES.GRADIENT. The code then uses this new custom style by including the STYLE= option in the ODS HTML statement, as follows:
ods html path='c:\temp' (url=none) file='gradient.html'
style=styles.gradient;
If you want to add a gradient shaded background to Listing output when you are not using any ODS statements, use the STYLE= option in the ODS LISTING statement, as follows:
ods listing style=styles.gradient;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
When run on a Windows operating system, this sample code will write out one HTML file named GRADIENT.HTML and one PNG file named GRADIENT.PNG to the TEMP folder on your C: drive. If you are running on an operating system other than Windows or if you want to write the HTML and PNG output to a directory other than C:\TEMP, modify the value for the PATH= option in the ODS HTML statement in the sample code.
This sample code must be run with SAS® 9.2 or higher.
proc template;
define style styles.gradient;
parent=styles.default;
style graphbackground from graphbackground /
gradient_direction = "Yaxis"
startcolor = red
endcolor = yellow;
end;
run;
goptions reset=all device=png;
ods listing close;
ods html path='c:\temp' (url=none) file='gradient.html'
style=styles.gradient;
title1 h=12pt 'Using a gradient background';
axis1 minor=none label=(angle=90 'Average Weight');
proc gchart data=sashelp.class;
where sex="F";
vbar age / sumvar=weight type=mean subgroup=age
nolegend discrete noframe width=5 space=2
raxis=axis1 autoref cref=white clipref
name='gradient';
run;
quit;
ods html close;
ods listing;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample demonstrates how to add a gradient shaded background to SAS/GRAPH® output.
| Type: | Sample |
| Topic: | SAS Reference ==> Procedures ==> GCHART
|
| Date Modified: | 2011-10-18 15:08:39 |
| Date Created: | 2011-09-01 11:29:16 |
Operating System and Release Information
| SAS System | SAS/GRAPH | z/OS | 9.2 TS1M0 | |
| Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS1M0 | |
| Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS1M0 | |
| Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS1M0 | |
| Microsoft Windows XP 64-bit Edition | 9.2 TS1M0 | |
| Microsoft® Windows® for x64 | 9.2 TS1M0 | |
| Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS1M0 | |
| Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS1M0 | |
| Microsoft Windows Server 2003 Standard Edition | 9.2 TS1M0 | |
| Microsoft Windows XP Professional | 9.2 TS1M0 | |
| Windows Vista | 9.2 TS1M0 | |
| Windows Vista for x64 | 9.2 TS1M0 | |
| 64-bit Enabled AIX | 9.2 TS1M0 | |
| 64-bit Enabled HP-UX | 9.2 TS1M0 | |
| 64-bit Enabled Solaris | 9.2 TS1M0 | |
| HP-UX IPF | 9.2 TS1M0 | |
| Linux | 9.2 TS1M0 | |
| Linux for x64 | 9.2 TS1M0 | |
| OpenVMS on HP Integrity | 9.2 TS1M0 | |
| Solaris for x64 | 9.2 TS1M0 | |