How does one generate a graph and embed it into an Excel document?
Hi:
There is no "ODS EXCEL" destination. So I'm not exactly sure what you mean. There are only a few ways to get data/reports from SAS to Excel:
1) Export methods (dataset --> workbook/worksheet)
a) PROC EXPORT (no graph support)
b) LIBNAME EXCEL engine (no graph support)
2) ODS methods (procedure output --> workbook/worksheet)
a) ODS CSV (comma separated values) (no graph support)
b) HTML-based destinations: ODS MSOFFICE2K, ODS MSOFFICE2K_X, ODS TAGSETS.TABLEEDITOR
c) XML-based destinations: ODS TAGSETS.EXCELXP (no graph support)
As you can see, as far as graph/image support goes, the only ODS destinations that support the inclusion of graph images are the HTML-based destinations, primarily the ones that are designed to work with Microsoft Office (Word, Excel). That is because the HTML that is created by ODS contains a standard HTML <IMG> tag that Excel knows how to open and include in the worksheet. To a certain extent, the file that you create does not contain "embedded" graphs. There are a lot of postings in the forum on using HTML-based methods to create files that Excel can open and render. And, there are a lot of Tech Support notes on using ODS to create files that Excel can open. Using image/graph files is one of the strengths of using using the HTML-based methods.
cynthia
Hi:
There is no "ODS EXCEL" destination. So I'm not exactly sure what you mean. There are only a few ways to get data/reports from SAS to Excel:
1) Export methods (dataset --> workbook/worksheet)
a) PROC EXPORT (no graph support)
b) LIBNAME EXCEL engine (no graph support)
2) ODS methods (procedure output --> workbook/worksheet)
a) ODS CSV (comma separated values) (no graph support)
b) HTML-based destinations: ODS MSOFFICE2K, ODS MSOFFICE2K_X, ODS TAGSETS.TABLEEDITOR
c) XML-based destinations: ODS TAGSETS.EXCELXP (no graph support)
As you can see, as far as graph/image support goes, the only ODS destinations that support the inclusion of graph images are the HTML-based destinations, primarily the ones that are designed to work with Microsoft Office (Word, Excel). That is because the HTML that is created by ODS contains a standard HTML <IMG> tag that Excel knows how to open and include in the worksheet. To a certain extent, the file that you create does not contain "embedded" graphs. There are a lot of postings in the forum on using HTML-based methods to create files that Excel can open and render. And, there are a lot of Tech Support notes on using ODS to create files that Excel can open. Using image/graph files is one of the strengths of using using the HTML-based methods.
cynthia
Great answer Cynthia. THanks!!!
So if I have a SAS server that does include an Web server running on it, and I want to generate a report and send it off to someone, there's no real way to include this with a graph, correct? (with HTML or XML)
I know I can do it with PDF.
Experimental underway 9.4:
UNDERSTANDING THE MICROSOFT OFFICE OPEN XML FORMAT
ods excel file="temp.xlsx";
http://support.sas.com/resources/papers/proceedings14/SAS177-2014.pdf
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.