ods html body,Embed scalable graphics using the ODS HTML5 destination

本文档介绍了如何使用SAS中的ODS HTML5目的地与SAS/GRAPH和SG程序配合,选择SVG或PNG设备驱动器来创建清晰的图形输出。SVG是一种矢量图形格式,适合在任何支持SVG的查看器或浏览器中清晰显示,而PNG则适用于内联图像。通过设置ODS选项和图形设备,可以在HTML输出中嵌入这些图形。
摘要由CSDN通过智能技术生成

Note: The default graphics output format for the ODS HTML5 destination is Scalable Vector Graphics (SVG). SVG documents display clearly at any size in any viewer or browser that supports SVG. So, SVG files are ideal for display on a computer monitor, PDA, or cell phone; or printed documents. Because it's a vector graphic, a single SVG document can be transformed to any screen resolution without compromising the clarity of the document. Here's an example:

94a37101dd7b6e506a719ac71e7202ac.png

The same SVG graph, scaled at 90% and then at 200%. But 100% crisp!

SAS/GRAPH procedures

When you use the ODS HTML5 destination with a SAS/GRAPH procedure, specify a value of SVG, PNG, or JPEG for the DEVICE option in the GOPTIONS statement. The following sample PROC GPLOT code embeds SVG graphics inside the resulting HTML output:goptions device=svg;

ods _all_ close;

ods html5 path="c:\temp" file="svg_graph.html";

symbol1 i=none v=squarefilled;

proc gplot data=sashelp.cars;

plot mpg_city * horsepower;

where make="Honda";

run;

quit;

ods html5 close;

ods preferences;

Note that the ODS PREFERENCES statement above resets the ODS environment back to its default settings when you use the SAS windowing environment.

When you use the PNG or JPEG device driver with the ODS HTML5 destination, add the BITMAP_MODE="INLINE" option to the ODS HTML5 statement. Here is an example:goptions device=png;

ods _all_ close;

ods html5 path="c:\temp" file="png_graph.html" options(bitmap_mode="inline");

symbol1 i=none v=squarefilled;

proc gplot data=sashelp.cars;

plot mpg_city * horsepower;

where make="Honda";

run;

quit;

ods html5 close;

ods preferences;

ODS Graphics and SG procedures

When you use SG procedures and ODS Graphics, specify a value of SVG, PNG, or JPEG for the OUTPUTFMT option in the ODS GRAPHICS statement. The following sample code uses PROC SGPLOT to embed SVG graphics inside the HTML output with the ODS HTML5 destination:ods _all_ close;

ods html5 path="c:\temp" file="svg_graph.html";

ods graphics on / reset=all outputfmt=svg;

proc sgplot data=sashelp.cars;

scatter y=mpg_city x=horsepower / markerattrs=(size=9PT symbol=squarefilled);

where make="Honda";

run;

ods html5 close;

ods preferences;

The following sample code uses PROC SGPLOT to embed PNG graphics inside the HTML output with the ODS HTML5 destination:

ods _all_ close;

ods html5 path="c:\temp" file="png_graph.html" options(bitmap_mode="inline");

ods graphics on / reset=all outputfmt=png;

proc sgplot data=sashelp.cars;

scatter y=mpg_city x=horsepower / markerattrs=(size=9PT symbol=squarefilled);

where make="Honda";

run;

ods html5 close;

ods preferences;

The technique above also works when you use the ODS GRAPHICS ON statement with other procedures that produce graphics output (such as the LIFETEST procedure).

Note that the ODS HTML5 destination supports the SAS Graphics Accelerator. The SAS Graphics Accelerator enables users with visual impairments or blindness to create, explore, and share data visualizations. It supports alternative presentations of data visualizations that include enhanced visual rendering, text descriptions, tabular data, and interactive sonification. Sonification uses non-speech audio to convey important information about the graph.

You can use the ODS HTML5 destination in most situations where you need to embed all of your output into a single HTML output location. For example, when you email HTML output as an attachment or when you create graphics output via a SAS stored process. If you currently use the ODS HTML destination, you might want to experiment with the ODS HTML5 destination to see whether it meets your needs even if you cannot completely switch to it yet.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值