Sample 36354: Using ODS HTML as an alternative to the %DS2HTM macro
The SAS® Output Delivery System (ODS) provides SAS users with the ability to write output to other destinations (such as HTML, PDF, and so on) in addition to the traditional output window. SAS users who are still using the older HTML formatting tools (for example, the
%DS2HTM, %OUT2HTM, and %TAB2HTM macros) might find the ODS functionality a more user-friendly, flexible option. This functionality simply requires adding two ODS statements: one before the procedure or DATA step that generates the output, and one at the end of the program to close the destination.
With regard to HTML output, one of the advantages of using the ODS HTML statement is that you can customize individual columns and table cells, whereas with the %DS2HTM macro, options apply to the entire table. The following example illustrates how to create output using both methods.
/* Using ODS HTML */
ods html file='ods.html' style=minimal;
proc print data=sashelp.class noobs;
title 'This output is created using ODS HTML';
run;
ods html close;
/* Using %DS2HTM */
title 'This output is created using %DS2HTM';
%ds2htm(data=sashelp.class,
htmlfile=ds2htm.html,
center=Y,
twidth=50);
For additional examples that illustrate how to customize ODS HTML output, see
Base SAS: SAS Notes and Concepts.
ODS is more widely supported, with new features added to it with each new SAS release. These advantages, as well as its ease of use, makes ODS a preferred choice for creating HTML output.
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.
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.
Date Modified: | 2009-07-15 14:58:28 |
Date Created: | 2009-06-25 09:57:52 |
Operating System and Release Information
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 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 | | |