Sample 49267: Create animated SVG output using PROC GCHART
Beginning with SAS® 9.4, you can create animated graphs in scalable vector graphics (SVG) format. New options available in the OPTIONS statement enable you to have a wide range of control over the SVG animation. Note that in order to take advantage of SVG graphics, you must use an SVG-enabled web browser to view the graphics output.
The sample code on the Full Code tab uses two PROC GCHART steps to create a bar chart that animates over time.
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.
Support for animated SVG graphics output is new starting with SAS 9.4. You must be running SAS 9.4 in order to run this sample code.
/* Set the DEVICE to SVG */
goptions reset=all device=svg cback=white border htext=12pt;
/* Set the SVG animation options */
options animduration=2 svgfadein=1 svgfadeout=1 animloop=yes
animate=start svgautoplay noanimoverlay
nodate nonumber
svgheight='400px' svgwidth='600px';
ods _all_ close;
ods html5 file='saleschart.html' options(svg_mode='inline')
style=seaside;
/* Create the sample data set by extracting information */
/* on Canada and Germany from Sashelp.Prdsale */
data work.qsales;
set sashelp.prdsale(where=(country="CANADA" or country="GERMANY")
keep=Actual Country Product Quarter Year);
run;
/* Sort the data by quarter */
proc sort data=work.qsales;
by quarter;
run;
/* Generate the first set of graphs */
title1 h=16pt "1993 Sales";
axis1 order=(0 to 30000 by 5000);
proc gchart data=work.qsales(where=(year=1993));
vbar3d country / sumvar=actual subgroup=product sum raxis=axis1 name='ch93sales'
shape=cylinder cframe=cxF2F2DF;
where product in("BED" "TABLE" "CHAIR");
by quarter;
run;
quit;
/* Generate the second set of graphs */
title1 h=16pt "1994 Sales";
proc gchart data=work.qsales(where=(year=1994));
vbar3d country / sumvar=actual subgroup=product sum raxis=axis1 name='ch94sales'
shape=cylinder cframe=cxF2F2DF;
where product in("BED" "TABLE" "CHAIR");
by quarter;
run;
options animate=stop;
quit;
ods html5 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 illustrates how to create animated SVG output using the GCHART procedure.
Date Modified: | 2013-07-02 08:58:40 |
Date Created: | 2013-02-25 10:18:51 |
Operating System and Release Information
SAS System | SAS/GRAPH | z/OS | 9.4 TS1M0 | |
Microsoft® Windows® for x64 | 9.4 TS1M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.4 TS1M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.4 TS1M0 | |
Microsoft Windows Server 2003 Standard Edition | 9.4 TS1M0 | |
Microsoft Windows Server 2003 for x64 | 9.4 TS1M0 | |
Microsoft Windows Server 2008 | 9.4 TS1M0 | |
Microsoft Windows Server 2008 for x64 | 9.4 TS1M0 | |
Microsoft Windows XP Professional | 9.4 TS1M0 | |
Windows 7 Enterprise 32 bit | 9.4 TS1M0 | |
Windows 7 Enterprise x64 | 9.4 TS1M0 | |
Windows 7 Home Premium 32 bit | 9.4 TS1M0 | |
Windows 7 Home Premium x64 | 9.4 TS1M0 | |
Windows 7 Professional 32 bit | 9.4 TS1M0 | |
Windows 7 Professional x64 | 9.4 TS1M0 | |
Windows 7 Ultimate 32 bit | 9.4 TS1M0 | |
Windows 7 Ultimate x64 | 9.4 TS1M0 | |
Windows Vista | 9.4 TS1M0 | |
Windows Vista for x64 | 9.4 TS1M0 | |
64-bit Enabled AIX | 9.4 TS1M0 | |
64-bit Enabled Solaris | 9.4 TS1M0 | |
HP-UX IPF | 9.4 TS1M0 | |
Linux for x64 | 9.4 TS1M0 | |
Solaris for x64 | 9.4 TS1M0 | |