Problem Note 11959: Graphs in Excel files generated from ODS may overlap
It is possible to create files that are automatically opened by
Microsoft Excel from the ODS HTML destination by including the .XLS
extension on the file name, such as:
ODS HTML FILE='FILE.XLS';
If graphs are included in the file, it is likely that the graphs will
overlap each other and/or tables when the file is displayed in Excel.
This is because the HTML destination does not store a HEIGHT with the
IMG tag. Without this HEIGHT value, Excel allots a certain amount of
space for each image, and this space may be too small.
To prevent the problem in SAS Release 8.2, the HEIGHT option can be
added to the IMG tag using a TAGSET. The output is then generated with
the experimental ODS MARKUP destination. An example is below.
To prevent the problem in SAS 9.1, use ODS MARKUP with the MSOFFICE2K
tagset. Be sure to reference it as TAGSET=TAGSETS.MSOFFICE2K.
Specifying TAGSET=MSOFFICE2K may have unpredictable results.
/* SAS Release 8.2 example. */
proc template;
define tagset tagsets.test;
parent=tagsets.phtml;
/* This section makes the background white. */
define event doc_body;
start:
put "<body BGCOLOR=WHITE onload=""startup()""";
put " onunload=""shutdown()""";
put " bgproperties=""Fixed""" / if exist( WATERMARK );
trigger style_inline;
put ">" NL;
put "<SCRIPT LANGUAGE=""JavaScript"">" NL;
put "<!-- " NL;
put "// This script is to load all object onLoad() functions " NL;
put "function startup(){}" NL;
put "function shutdown(){}" NL;
put " " NL;
put "//-->" NL;
put "</SCRIPT>" NL;
put NL;
finish:
put "</body>" NL;
end;
/* This section sets the height and width for the image. */
define event image;
put "<img";
put " src=""";
put BASENAME / if !exist( NOBASE );
put URL;
put """";
putq " border=" BORDERWIDTH;
put " usemap=""#" @CLIENTMAP;
put """" NL / if exist(BORDERWIDTH,@CLIENTMAP);
putq " class=" HTMLCLASS;
putq " id=" HTMLID;
putq "alt=""this is a test""";
/* HEIGHT and WIDTH correspond to YPIXELS and XPIXELS on GOPTIONS */
PUTQ "HEIGHT=400 WIDTH=500";
put ">" NL;
end;
end;
run;
/* Explicitly setting XPIXELS and YPIXELS so graph is not distorted. */
goptions reset=all device=gif XPIXELS=500 YPIXELS=400 border;
ods listing close;
ods markup body='file.xls' tagset=tagsets.test;
/* procedures go here */
ods markup close;
goptions reset=all;
ods listing;
Operating System and Release Information
| SAS System | SAS/GRAPH | Microsoft Windows XP Professional | 8.2 TS2M0 | 9.2 TS1M0 |
| Microsoft Windows NT Workstation | 8.2 TS2M0 | |
| Microsoft Windows 95/98 | 8.2 TS2M0 | |
| Windows Millennium Edition (Me) | 8.2 TS2M0 | |
| Microsoft Windows Server 2003 Datacenter Edition | 8.2 TS2M0 | 9.2 TS1M0 |
| Microsoft Windows Server 2003 Enterprise Edition | 8.2 TS2M0 | 9.2 TS1M0 |
| Microsoft Windows Server 2003 Standard Edition | 8.2 TS2M0 | 9.2 TS1M0 |
| Microsoft Windows 2000 Server | 8.2 TS2M0 | 9.2 TS1M0 |
| Microsoft Windows 2000 Professional | 8.2 TS2M0 | 9.2 TS1M0 |
| Microsoft Windows 2000 Datacenter Server | 8.2 TS2M0 | 9.2 TS1M0 |
| Microsoft Windows 2000 Advanced Server | 8.2 TS2M0 | 9.2 TS1M0 |
| Solaris | 8.2 TS2M0 | 9.2 TS1M0 |
| OpenVMS VAX | 8.2 TS2M0 | 9.2 TS1M0 |
| 64-bit Enabled Solaris | 8.2 TS2M0 | 9.2 TS1M0 |
| z/OS | 8.2 TS2M0 | 9.2 TS1M0 |
| IRIX | 8.2 TS2M0 | 9.2 TS1M0 |
| OS/2 | 8.2 TS2M0 | |
| ABI+ for Intel Architecture | 8.2 TS2M0 | 9.2 TS1M0 |
| Linux | 8.2 TS2M0 | 9.2 TS1M0 |
| 64-bit Enabled HP-UX | 8.2 TS2M0 | 9.2 TS1M0 |
| HP-UX | 8.2 TS2M0 | 9.2 TS1M0 |
| Tru64 UNIX | 8.2 TS2M0 | 9.2 TS1M0 |
| 64-bit Enabled AIX | 8.2 TS2M0 | 9.2 TS1M0 |
| OpenVMS Alpha | 8.2 TS2M0 | 9.2 TS1M0 |
| CMS | 8.2 TS2M0 | 9.2 TS1M0 |
| AIX | 8.2 TS2M0 | 9.2 TS1M0 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
| Type: | Problem Note |
| Priority: | |
| Topic: | SAS Reference ==> ODS (Output Delivery System)
|
| Date Modified: | 2004-03-12 11:53:07 |
| Date Created: | 2004-03-12 11:53:07 |