BookmarkSubscribeRSS Feed
Attyslogin
Obsidian | Level 7

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 ?

4 REPLIES 4
Cynthia_sas
SAS Super FREQ

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

Attyslogin
Obsidian | Level 7

I tried content_type= as well as type= options but still receiving the same code in output. What else can be done ?

Cynthia_sas
SAS Super FREQ
Hi:
Talk to your mail administrators to see whether you are allowed to use HTML in the body of an email; or send the HTML file as an attachment (or better yet, make a PDF file and use that as an attachment -- most mail systems allow PDF); or open a track with Tech Support.

cynthia
Attyslogin
Obsidian | Level 7

Admin says it is allowed.

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 3004 views
  • 0 likes
  • 2 in conversation