Emailing output using ODS to the body of an email might look different when rendered with Microsoft Outlook 2007 and later versions


When using ODS HTML to send output from SAS® 9 to the body of an email, the style of the output might look very different when it is rendered with Microsoft Outlook 2007 and higher. This can occur because Outlook 2007 and higher does not fully support cascading style sheets (CSS) the same as Microsoft Internet Explorer or the previous version of Outlook.

Beginning with Microsoft Outlook 2007, it has vastly changed in how it renders email. Instead of using Internet Explorers's HTML rendering, it uses the Microsoft Word 2007 HTML Viewer, which does not handle all of the CSS's the same way. If we select to have this opened and viewed in the browser from Outlook 2007, the style information such as the colors and the borders look fine.

To circumvent this problem using SAS 9, use either the ODS MSOffice2K or the ODS HTML3 destination instead of the ODS HTML destination. Each of the suggested destinations generate HTML, and will display much better in Word's HTML viewer. See the Full Code section for an example.

Full Code

/* The -EMAILSYS option needs to be set to SMTP along with the -EMAILHOST   */ 
/* option with the value of your mail server.                               */

filename temp email to="someemail@sas.com"
                    content_type="text/html"
                    subject="Writing output to the body of e-mail";

ods msoffice2k file=temp;

proc print data=sashelp.class;
run;

ods msoffice2k close;