this is my program
filename ofmail email
to="zzzzz@gmail.com"
subject="sashelp.class";
ods html body=ofmail style=normal;
proc print data=sashelp.class;
run;
ods html close;
output in email looks like below instead of sashelp.class table
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta name="Generator" content="SAS Software Version 9.4, see www.sas.com"> <meta http-equiv="Content-type" content="text/html; charset=windows-1252"> <title>SAS Output</title> <style type="text/css">
<!--
.aligncontents
{
background-color: transparent;
border: 0px solid #000000;
border-spacing: 0px;
color: #000000;
font-family: 'Trebuchet MS', Helvetica, Arial, 'Albany AMT', sans-serif;
font-size: 12pt;
font-style: normal;
font-weight: normal;
margin: 0px;
padding: 5px;
text-align: left;
vertical-align: middle;
}
.batch
{
background-color: #FFFFFF;
border-bottom-width: 1px;
border-color: #3872AC;
border-left-width: 2px;
border-right-width: 1px;
border-spacing: 0px;
border-style: solid;
border-top-width: 2px;
color: #000000;
font-family: 'Courier New', Courier, fixed;
font-size: 9pt;
font-style: normal;
font-weight: bold;
.
..
and so on diff weird code.
why this happening ?
Hi:
The "diff weird code" is exactly what you told ODS to send to your FILENAME OFMAIL file using the EMAIL engine.
ODS HTML created an HTML file, a pure HTML 4 file, as you can see from the <DOCTYPE> at the top of the file. If you want to send this file as an attachment, then you need to use the ATTACH= option in your FILENAME statement and, generally, create the HTML file BEFORE you initiate the email. In this case, the BODY of your mail is created with a DATA step that just says something like here's the report for sashelp.class or something like that and then the receiver of the mail opens/saves the attachment.
If you are allowed by your mail system to send HTML in the body of the mail (something you should check before you try this, since many email systems block sending HTML in an email), then you need to follow a different method, such as adding content_type="text/html" to your FILENAME statement.
See the example code on this Tech Support note for more information http://support.sas.com/kb/23/636.html
cynthia
I tried content_type= as well as type= options but still receiving the same code in output. What else can be done ?
Admin says it is allowed.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.