When exporting output to Excel using ODS or other methods, the output does not alway appear the same way in Excel as it does in SAS. This is because Excel uses the General format when it imports the data. There are various types of values which are known to appear differently when this General format is applied in Excel such as the following:
Excel formats or custom strings are applied differently using the ExcelXP and the MSOffice2K destinations. Custom Excel formats are passed using the TAGATTR= attribute with the ExcelXP destination. The MSOffice2K destination uses the HTMLSTYLE= attribute to pass custom Excel formats.
The sample code on the Full Code tab demonstrates how to pass formats with the ODS TAGSETS.EXCELXP destination.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
data one;
input leading trailing long_val $14. comma_val dollar_val invalid_str $5.;
format leading z6.;
datalines;
012345 123450 1234567891012 1234567 -1234567 00E11
;
run;
ods tagsets.excelxp file="temp.xls" ;
proc print data=one;
var leading / style(data)={tagattr="format:@"};
var trailing / style(data)={tagattr="format:#####.#0"};
var long_val / style(data)={tagattr="format:#,###"};
var comma_val / style(data)={tagattr="format:#,###"};;
var dollar_val / style(data)={tagattr="format:$#,###;$-#,###"};
var invalid_str / style(data)={tagattr="format:@"};
run;
ods tagsets.excelxp close;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Type: | Sample |
Date Modified: | 2010-10-20 15:29:57 |
Date Created: | 2009-12-10 11:33:45 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | Base SAS | z/OS | ||
OpenVMS VAX | ||||
Microsoft® Windows® for 64-Bit Itanium-based Systems | ||||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | ||||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | ||||
Microsoft Windows XP 64-bit Edition | ||||
Microsoft® Windows® for x64 | ||||
OS/2 | ||||
Microsoft Windows 95/98 | ||||
Microsoft Windows 2000 Advanced Server | ||||
Microsoft Windows 2000 Datacenter Server | ||||
Microsoft Windows 2000 Server | ||||
Microsoft Windows 2000 Professional | ||||
Microsoft Windows NT Workstation | ||||
Microsoft Windows Server 2003 Datacenter Edition | ||||
Microsoft Windows Server 2003 Enterprise Edition | ||||
Microsoft Windows Server 2003 Standard Edition | ||||
Microsoft Windows Server 2008 | ||||
Microsoft Windows XP Professional | ||||
Windows 7 Enterprise 32 bit | ||||
Windows 7 Enterprise x64 | ||||
Windows 7 Home Premium 32 bit | ||||
Windows 7 Home Premium x64 | ||||
Windows 7 Professional 32 bit | ||||
Windows 7 Professional x64 | ||||
Windows 7 Ultimate 32 bit | ||||
Windows 7 Ultimate x64 | ||||
Windows Millennium Edition (Me) | ||||
Windows Vista | ||||
64-bit Enabled AIX | ||||
64-bit Enabled HP-UX | ||||
64-bit Enabled Solaris | ||||
ABI+ for Intel Architecture | ||||
AIX | ||||
HP-UX | ||||
HP-UX IPF | ||||
IRIX | ||||
Linux | ||||
Linux for x64 | ||||
Linux on Itanium | ||||
OpenVMS Alpha | ||||
OpenVMS on HP Integrity | ||||
Solaris | ||||
Solaris for x64 | ||||
Tru64 UNIX |