Specifying Body Files for Displaying Graphs


When you use ODS with SAS/GRAPH, you specify a body file to reference the graphics output. A body file is simply an HTML file that is created by ODS to contain non-graphics output, and to reference graphics output so that it displays as if it were part of the HTML file. You can use many body files during the SAS session, although only one at a time can be open . The following table shows a body file that references charts that were generated by PROC GCHART.

click to expand
Display 16.2: Displaying a Body File in a Browser

To open a body file, use the ODS statement option BODY=. The following code creates a body file named sales.html, which is created in the output location specified on the FILENAME statement.

 filename odsout '  path-to-Web-server  ';  goptions device=gif;  ods html body='sales.html' path=odsout; 

The body file remains open and all graphics and non-graphics output is written to it until the HTML destination is closed or another body file is opened.

To direct output to multiple body files, use an ODS statement with the BODY= option each time you want to close the current body file and open another:

 filename odsout '  path-to-Web-server  ';  goptions device=gif;  ods html body='sales.html' path=odsout;  /* code whose output goes to sales.html */  ods html body='costs.html' path=odsout;  /* code whose output goes to costs.html */  ods html close; 

Using the PATH= option puts all output files in one location. Using PATH= and GPATH= puts the image output files in a different location.

If you use BY- group processing on a graphics procedure, a separate graph is generated for each value of the BY variable. In that case, all the graphs will be referenced in the same body file, unless you use the ODS statement s NEWFILE= option. For example, you might use NEWFILE=OUTPUT:

 /* use newfile= to open a new */   /* body file for each graph */  filename odsout '  path-to-Web-server  ';  goptions device=gif;  ods html body='sales.html' path=odsout      newfile=output; 

NEWFILE=OUTPUT opens a new body file for each new graph that is generated, whether the graphs are generated with BY-group processing or by multiple procedure runs. The new body files are named by appending consecutive numbers to the name you specify in the BODY= option. In the example above, the initial body file is named sales.html, and the additional body files that are created will be named sales1.html, sales2.html, and so on.

To determine the appearance of output on the Web page, the body file uses table definitions and style definitions. This document shows output with the default definitions. Other definitions are available with the STYLE= option. You can also create your own style definitions. For information on table definitions and style definitions, see SAS Output Delivery System: User s Guide .




SAS.GRAPH 9.1 Reference, Volumes I and II
SAS.GRAPH 9.1 Reference, Volumes I and II
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 342

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net