Take note of the email type: Type = 'text/html';
Filename myEmail EMAIL
Subject = "My Email Subject"
From = "[email protected]"
To = '[email protected]'
CC = '[email protected]'
Type = 'text/html';
Data _null_; File myEmail;
PUT "
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
</style>
</head>
<body>
<p>Here is your email</p>
<p>Go ahead, organize your data within an HTML table tag here!</p>
<table>
<tr>
<th>
column 1
</th>
<th>
column 2
</th>
</tr>
<tr>
<td>
&countOfRecords1
</td>
<td>
&countOfRecords2
</td>
</tr>
</table>
</body>
</html>
";
RUN;
It is very possible that after building out an HTML email in SAS, you find the HTML is distorted when you receive the email. This is a result of SAS putting breaks to the next line in the text of your PUT. A break was probably placed right in the middle of one of your tag's text. Should this happen to you, try moving your HTML tags around. It may not be pretty, but you may have to have some tags share a line to avoid this happening. This happened to me, and this is exactly how I fixed that issues.