Sample 49260: Create animated SVG graphics output using PROC GPLOT
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 PROC GPLOT with a BY statement together with the SVG device driver to create an animated scatter plot.
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.
/* Create sample data */
data a;
input year 5. revenue1 6. revenue2 6.;
datalines;
1999 22150 25260
2000 25600 22900
2001 26800 21400
2002 22000 20300
2003 21000 22500
2004 22000 25100
2005 23500 27000
2006 26100 25000
2007 27600 23700
2008 26200 23000
2009 27000 25300
2010 29300 27560
;
run;
/* Set the DEVICE= option to SVG */
goptions reset=all device=svg border cback=white hby=0;
/* Set the SVG animation options */
options svgheight="400px" svgwidth="600px" nodate nonumber
animation=start animloop=yes animduration=.5 noanimoverlay;
ods _all_ close;
ods html5 file='svg_loopplot.html' options(svg_mode='inline');
axis1 order=(20000 to 30000 by 1000) value=(color=gray)
label=(angle=90 h=2 'Revenue')
minor=none offset=(0,0);
axis2 order=(1999 to 2010 by 1) value=(color=gray) minor=none
offset=(0,0) label=(h=2);
title1 c=blue h=18pt "SVG Animation with GPLOT";
legend1 label=none value=(h=2);
symbol1 v=dot h=3 i=spline c=red;
symbol2 v=Star h=3 i=spline c=blue;
proc gplot data=work.a;
by year notsorted;
plot revenue1*year revenue2*year / overlay legend ctext=blue
name='loopplot' legend=legend1
cframe=AFFFFFF00 href=(2002 2005 2008)
haxis=axis2 vaxis=axis1;
run;
quit;
ods _all_ 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 graphics output using the GPLOT procedure.
Date Modified: | 2013-07-02 08:58:53 |
Date Created: | 2013-02-22 16:14:03 |
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 | |