以下内容摘自:
http://support.sas.com/kb/37/261.html,希望对楼主有用。
This sample SAS code demonstrates two methods for creating SVG output.
- /* This sample program uses the SVG SAS/GRAPH */
- /* device driver with the ODS HTML statement. */
- /* This sample code demonstrates how to create */
- /* scalable vector graphics output that */
- /* provides pop-up tool tips along with drill */
- /* down capability. */
- filename odsout 'c:\temp';
- %let textcolor=gray66;
- proc format;
- value measfmt
- 1='Satisfaction with\SAS software'
- 2='Satisfaction with\SAS relationship'
- 3='Likely to\recommend renewal';
- run;
- data mydat;
- format Satisfaction percent7.0;
- format Measure measfmt.;
- input Measure Training $ 3-19 Satisfaction;
- cards;
- 1 Attended Training .93
- 1 No Training .86
- 2 Attended Training .85
- 2 No Training .76
- 3 Attended Training .92
- 3 No Training .84
- ;
- run;
- data my_data;
- set mydat;
- length myhtml $ 1024;
- myhtml='title='|| quote( trim(left(put(measure,measfmt.))) || '0d'x
- || 'Statisfaction: ' || trim(left(put(satisfaction,percent7.0)))||' ')
- || 'href="http://sww.sas.com/"';
- run;
- goptions reset=goptions device=svg;
- ods listing close;
- ods html path=odsout body="svgsample1.htm" (title="SAS Customer Satisfaction & Training");
- goptions noborder;
- goptions gunit=pct htext=3.1 ctext=&textcolor ftext="Thorndale AMT/bold";
- goptions cback=white;
- axis1 c=graycc label=none value=none;
- axis2 c=graycc label=none value=(c=&textcolor) order=(.60 to .95 by .05) minor=none offset=(0,0);
- axis3 c=graycc label=none value=(c=&textcolor height=3) split='\' offset=(7,5);
- legend1 position=(middle right) mode=share shape=bar(.12in,.12in) across=1 label=none offset=(1,28);
- pattern1 value=solid color=cx1b3f8b;
- pattern2 value=solid color=cxcd0000;
- title1 h=10 " ";
- title2 j=left c=gray55 f="Thorndale AMT/bold" h=6 " Training Drives Satisfaction & Loyalty";
- title3 j=left ls=1.1 " Creating Opportunity for New Sales";
- title4 h=4 " ";
- title5 a=-90 h=3 " ";
- footnote1 h=3 " ";
- footnote2 j=left " ** Training customers happier in all 31 measures";
- footnote3 h=2 " ";
- proc gchart data=my_data;
- vbar3d Training / discrete
- type=sum sumvar=Satisfaction
- outside=sum
- group=Measure
- cframe=white
- space=0
- width=10
- gspace=15
- subgroup=Training
- maxis=axis1
- raxis=axis2
- gaxis=axis3
- coutline=same
- legend=legend1
- noframe
- html=myhtml
- des="";
- run;
- quit;
- axis4 c=graycc label=none value=(c=&textcolor) order=(0 to 1.00 by .20) minor=none offset=(0,0);
- legend2 position=(middle right) mode=share shape=bar(.12in,.12in) across=1 label=none offset=(1,31);
- proc gchart data=my_data;
- vbar3d Training / discrete
- type=sum sumvar=Satisfaction
- outside=sum
- group=Measure
- cframe=white
- space=0
- width=10
- gspace=15
- subgroup=Training
- maxis=axis1
- raxis=axis4
- gaxis=axis3
- coutline=same
- legend=legend2
- noframe
- des="";
- run;
- quit;
- proc gchart data=my_data;
- vbar Training / discrete
- type=sum sumvar=Satisfaction
- outside=sum
- group=Measure
- cframe=white
- space=0
- width=10
- gspace=15
- subgroup=Training
- maxis=axis1
- raxis=axis4
- gaxis=axis3
- coutline=graycc
- legend=legend2
- noframe
- des="";
- run;
- quit;
- ods html close;
- ods listing;
- /* This sample program uses the PRINTERPATH=SVGT */
- /* system option together with the ODS PRINTER */
- /* statement. The SVGT printer is used to create */
- /* output with no background, producing a */
- /* transparent effect. Each page in the document */
- /* is overlaid. This allows you to see through */
- /* to all pages in the document. This is an */
- /* example of overlaying a bar chart with a */
- /* transparent background onto a map with the */
- /* SVGT printer. This allows the map area behind */
- /* the bar chart to be visible. */
- data boxanno;
- length function color style $20 text $16;
- retain xsys ysys '2' hsys '3' when 'a';
- set maps.uscity(keep=x y city state);
- where city='Raleigh' and state=stfips('NC');
- color='blue'; size=4; text='V'; position='5'; style='marker'; output;
- myx=x;
- myy=y;
- function='move';
- x=myx; y=myy; output;
- function='draw';
- x=myx-.432; y=myy+.0417; color='gray'; line=1; size=.2; style='solid'; output;
- function='move';
- x=myx; y=myy; output;
- function='draw';
- x=myx-.432; y=myy+.178; output;
- function='move';
- x=myx; y=myy; output;
- function='draw';
- x=myx-.251; y=myy+.178; output;
- function='move';
- x=myx; y=myy; output;
- function='draw';
- x=myx-.251; y=myy+.0417; output;
- run;
- %let name=annomap;
- goptions reset=all border gunit=pct htitle=5 htext=3
- ftext="arial/bo";
- options printerpath=svgt nodate nonumber;
- ods listing close;
- ods printer file='c:\temp\annomap.svg' ;
- pattern1 v=s c=cornsilk;
- title1 c=red "SAS/Graph gmap and overlayed gchart with printerpath=svgt";
- proc gmap data=maps.us map=maps.us ;
- id state;
- choro state / levels=1 nolegend coutline=blue anno=boxanno
- des="" name="&name";
- run;
- quit;
- goptions hsize=2.07 vsize=1.57 horigin=2.1
- vorigin=3.12 autosize=on device=svgt;
- /* You must use the default ODS style for transparency to work */
- goptions gunit=pct htext=12 ftext="Albany AMT" ;
- title 'Transparent SVG';
- pattern1 v=s c=red;
- axis1 label=none value=none major=none minor=none style=0;
- axis2 color=blue label=none offset=(7,7) value=(color=blue);
- proc gchart data=sashelp.class;
- vbar3d age / discrete descending raxis=axis1 maxis=axis2 width=9 space=5
- frame autoref coutline=blue woutline=1
- des="" name="&name.b";
- run;
- quit;
- ods printer close;
- ods listing;
复制代码