Since the original question was how to do something that you can do in Excel, I took that same "look/behavior" to be the requirement. When I make a chart in Excel and then insert a data table, the table appears IMMEDIATELY underneath the X axis of the chart, within the Excel "object" that holds the graph. Similar to the Equity Fund Example here: http://robslink.com/SAS/democd17/funds.htm (which uses SAS, GPLOT and ANNOTATE)
When you use SAS to create images and route the images to ODS, the Images are converted to the "internal" format for PS, PDF and RTF -- So, for those destinations, unless you can edit the file, the image and table -will- stay together -- not because the table is physically inside the graph area, but because the PS file is the container that holds both objects. Images are placed in an external image file (pointed to by <IMG>) for HTML. For LaTeX, the images are put into PS files for inclusion in the LaTeX document.
If you want ONE image with the data table "inside" the boundary of the image/graph area (as shown in the above example), then technically PROC PRINT or PROC REPORT don't fit the requirement because they place the graph in a table that is external to the graph image area.
Even if you make a PS file that now contains the image and the table in a single file, you have to be able to USE or RENDER the PS file if anyone wants to LOOK at the output. So, the PS file would have to be printed, viewed with GhostView, inserted into a LaTeX document (which might need further processing to be rendered and viewable) or distilled into PDF.
Bob Allison's link is an excellent site with lots of good SAS/Graph and some ODS Graphics examples. He uses ANNOTATE extensively and has posted ALL the code that goes with his graph examples. http://robslink.com/SAS/Home.htm
> Since the original question was how to do something
> that you can do in Excel, I took that same
> "look/behavior" to be the requirement.
Digressing momentarily, I opine that using SAS/GRAPH to emulate the look and feel of Excel graphics is one of the stupidest and most pointless things people can do. Excel graphics are poorly designed to convey information ... just ask any graphics design expert.
I am frequently puzzled by the amount of time, money and energy that people spend trying to make SAS/ODS output look like something that they can do in Excel. But I've also learned that sometimes folks just aren't ready to break the umbilical cord to Mother Microsoft.
Annotate would place/position the information in the graphic image area. PRINT/REPORT would position the table outside the graph area -- as a separate, tabular object. If you used the ODS HTMLPANEL destination, you can place the image and the table side by side, or in two rows. But they would still be physically separate, the graphic image would not contain the data table.
There may be an alternative to Annotate, depending on the size of the data table. In SAS 9.2, you could use the SGPLOT procedure, which has an INSET statement. That allows placement, generally, of smaller tables. For example, this PROC SQL step gets the highest HIGH, the maximum CLOSE and the lowest LOW numbers and writes them with an INSET statement:
proc sql noprint;
min(low) into :maxclose, :maxhigh, :minlow
where (date >= "01jan2000"d and stock = "IBM");
proc sgplot data=sashelp.stocks
(where=(date >= "01jan2000"d and stock = "IBM"));
title "Stock Trend";
series x=date y=close;
series x=date y=low;
series x=date y=high;
inset ("Max Close" = "&maxclose"
"Highest High" = "&maxhigh"
"Lowest Low"=" &minlow")
/ border valuealign=left position=topright
In order to use the SG procedures, you must have SAS 9.2. For large data tables, with a lot of columns or many rows, the inset approach would not be effective since the text box is positioned -inside- the plot area.