<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: send email from SAS-add reports and text in body of email in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/send-email-from-SAS-add-reports-and-text-in-body-of-email/m-p/851889#M336740</link>
    <description>&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;The text in email body is located in left side as I wanted.&lt;/P&gt;
&lt;P&gt;Also the two summary reports are displayed in left side as I wanted.&lt;/P&gt;
&lt;P&gt;However,&lt;/P&gt;
&lt;P&gt;There are some empty boxed that I want to remove&lt;/P&gt;
&lt;P&gt;Also in start of email it is written "class"&amp;nbsp; and I don't know how to remove it and why it came there&lt;/P&gt;
&lt;P&gt;Please see the email that was sent&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ronein_0-1672727195865.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78990i7A3E34449777A4EB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ronein_0-1672727195865.png" alt="Ronein_0-1672727195865.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
options 
   nocenter
   emailsys=smtp 
   emailhost=smtp.leumi
   emailport=25
;
FILENAME mail EMAIL 
TO="Dave@gmail.com"
FROM='Dave@gmail.com'
SUBJECT="www" 
CONTENT_TYPE="text/html" 
encoding="utf-8";
ODS LISTING CLOSE;
ODS HTML BODY=mail;
 proc odstext;
 heading 'My Report' /Style=Header {fontsize=16pt  color=blue  fontstyle=italic};
 p 'Hello, please find my report below.';
 p '';
 p '';
 p '';
 p '';
 p 'Kind Regards,';
 p 'Dave';
run;
title;
Title 'Cars';
proc report data = SasHelp.Cars(obs = 5) split = "*";
   column Type MPG_Ratio MPG_City MPG_Highway;
   define Type / display ;
   define MPG_City / display;
   define MPG_Highway / display;
   define MPG_Ratio / computed 'City/Highway' format = 4.2;
   compute MPG_Highway;   
      MPG_Ratio = MPG_City/MPG_Highway;
   endcomp;
run;
title;
Title 'class';
proc report data = SasHelp.class(obs = 5);
run;
ODS HTML CLOSE;
ODS LISTING;

 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Jan 2023 06:27:20 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2023-01-03T06:27:20Z</dc:date>
    <item>
      <title>send email from SAS-add reports and text in body of email</title>
      <link>https://communities.sas.com/t5/SAS-Programming/send-email-from-SAS-add-reports-and-text-in-body-of-email/m-p/851803#M336709</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I am sending email via sas program and I have some modifications that I want to do:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;&lt;FONT color="#000000"&gt;Issue 1:&lt;/FONT&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I want to add some text in the body of email.&lt;/P&gt;
&lt;P&gt;I added data _null_ statement but I don't see the text in the body of email.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;&lt;FONT color="#000000"&gt;Issue 2:&lt;/FONT&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I want that the text in body will be displayed on left side of email&lt;/P&gt;
&lt;P&gt;Issue 3:&lt;/P&gt;
&lt;P&gt;I want that the tables in body of email will be displayed on left side of email&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
/****Send Report via email***********/
/****Send Report via email***********/
/****Send Report via email***********/
options 
emailsys=smtp 
emailhost=smtp.leumi
emailport=25;

FILENAME mail EMAIL 
TO="&amp;lt;Joe@gmail.com&amp;gt;"
FROM='&amp;lt;Joe@gmail.com&amp;gt;'
SUBJECT="XXXX" 
CONTENT_TYPE="text/html" 
encoding="utf-8";
ODS LISTING CLOSE;
ODS HTML BODY=mail;

data _null_;
put 'Hello,';
put "Please find report";
put '  ';
put '  ';
put '  ';
put 'Kind Regards,';
run;

Title 'Cars';
proc report data = SasHelp.Cars(obs = 5) split = "*";
column Type MPG_Ratio MPG_City MPG_Highway;
define Type / display ;
define MPG_City / display;
define MPG_Highway / display;
define MPG_Ratio / computed 'City/Highway' format = 4.2;
compute MPG_Highway;  
MPG_Ratio = MPG_City/MPG_Highway;
endcomp;
run;

Title 'class';
proc report data = SasHelp.class(obs = 5);
run;

ODS HTML CLOSE;
ODS LISTING;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jan 2023 09:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/send-email-from-SAS-add-reports-and-text-in-body-of-email/m-p/851803#M336709</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2023-01-02T09:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: send email from SAS-add reports and text in body of email</title>
      <link>https://communities.sas.com/t5/SAS-Programming/send-email-from-SAS-add-reports-and-text-in-body-of-email/m-p/851832#M336721</link>
      <description>&lt;P&gt;For issue 1, your DATA _NULL_ step is writing to the SAS Log, not to ODS. For Issues 2 and 3, try setting the NOCENTER system option. Something like this should work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/****Send Report via email***********/
/****Send Report via email***********/
/****Send Report via email***********/
options 
   &lt;STRONG&gt;nocenter&lt;/STRONG&gt;
   emailsys=smtp 
   emailhost=smtp.leumi
   emailport=25
;

FILENAME mail EMAIL 
TO="&amp;lt;Joe@gmail.com&amp;gt;"
FROM='&amp;lt;Joe@gmail.com&amp;gt;'
SUBJECT="XXXX" 
CONTENT_TYPE="text/html" 
encoding="utf-8";
ODS LISTING CLOSE;
ODS HTML BODY=mail;

data _null_;
   &lt;STRONG&gt;file print;&lt;/STRONG&gt;
   put 'Hello,';
   put "Please find report";
   put '  ';
   put '  ';  
   put '  ';
   put 'Kind Regards,';
run;

Title 'Cars';
proc report data = SasHelp.Cars(obs = 5) split = "*";
   column Type MPG_Ratio MPG_City MPG_Highway;
   define Type / display ;
   define MPG_City / display;
   define MPG_Highway / display;
   define MPG_Ratio / computed 'City/Highway' format = 4.2;
   compute MPG_Highway;   
      MPG_Ratio = MPG_City/MPG_Highway;
   endcomp;
run;

Title 'class';
proc report data = SasHelp.class(obs = 5);
run;

ODS HTML CLOSE;
ODS LISTING;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Jan 2023 14:46:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/send-email-from-SAS-add-reports-and-text-in-body-of-email/m-p/851832#M336721</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2023-01-02T14:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: send email from SAS-add reports and text in body of email</title>
      <link>https://communities.sas.com/t5/SAS-Programming/send-email-from-SAS-add-reports-and-text-in-body-of-email/m-p/851834#M336723</link>
      <description>&lt;P&gt;The content from your DATA _null_ step is not added to the file that you are targeting for email. Since you want the content to be HTML, consider using PROC ODSTEXT instead -- inside of the ODS HTML block --&amp;nbsp; to capture the text you want to add above your report. &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsproc/p01vqfrzpxj3bgn1x9elf98takez.htm" target="_self"&gt;Check the documentation&lt;/A&gt; for style/formatting options and examples.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;proc odstext;
 heading 'MY Report!';
 p 'Hello, please find my report below.';
run;

Title 'Cars';
proc report data = SasHelp.Cars(obs = 5) split = "*";
column Type MPG_Ratio MPG_City MPG_Highway;
define Type / display ;
define MPG_City / display;
define MPG_Highway / display;
define MPG_Ratio / computed 'City/Highway' format = 4.2;
compute MPG_Highway;  
MPG_Ratio = MPG_City/MPG_Highway;
endcomp;
run;

Title 'class';
proc report data = SasHelp.class(obs = 5);
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jan 2023 14:49:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/send-email-from-SAS-add-reports-and-text-in-body-of-email/m-p/851834#M336723</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2023-01-02T14:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: send email from SAS-add reports and text in body of email</title>
      <link>https://communities.sas.com/t5/SAS-Programming/send-email-from-SAS-add-reports-and-text-in-body-of-email/m-p/851886#M336738</link>
      <description>&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;As I see you made 2 modifications to my code:&lt;/P&gt;
&lt;P&gt;1- You added&amp;nbsp; " file print;"&amp;nbsp; &amp;nbsp;statement&amp;nbsp; to&amp;nbsp; "data _null_;"&amp;nbsp; statement.&lt;/P&gt;
&lt;P&gt;Can you explain what did it do? change the print on Log to email?&lt;/P&gt;
&lt;P&gt;2-You added "nocenter"&amp;nbsp; to "Options".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please see the email that was sent:&lt;/P&gt;
&lt;P&gt;Some of the text is not on Left side&lt;/P&gt;
&lt;P&gt;Also the titles are in boxes and I dont want boxes.&lt;/P&gt;
&lt;P&gt;Also there are some empty boxes and I dont want it&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ronein_0-1672726272764.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78989i76C254D858E1EC7B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ronein_0-1672726272764.png" alt="Ronein_0-1672726272764.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 06:11:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/send-email-from-SAS-add-reports-and-text-in-body-of-email/m-p/851886#M336738</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2023-01-03T06:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: send email from SAS-add reports and text in body of email</title>
      <link>https://communities.sas.com/t5/SAS-Programming/send-email-from-SAS-add-reports-and-text-in-body-of-email/m-p/851889#M336740</link>
      <description>&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;The text in email body is located in left side as I wanted.&lt;/P&gt;
&lt;P&gt;Also the two summary reports are displayed in left side as I wanted.&lt;/P&gt;
&lt;P&gt;However,&lt;/P&gt;
&lt;P&gt;There are some empty boxed that I want to remove&lt;/P&gt;
&lt;P&gt;Also in start of email it is written "class"&amp;nbsp; and I don't know how to remove it and why it came there&lt;/P&gt;
&lt;P&gt;Please see the email that was sent&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ronein_0-1672727195865.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78990i7A3E34449777A4EB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ronein_0-1672727195865.png" alt="Ronein_0-1672727195865.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
options 
   nocenter
   emailsys=smtp 
   emailhost=smtp.leumi
   emailport=25
;
FILENAME mail EMAIL 
TO="Dave@gmail.com"
FROM='Dave@gmail.com'
SUBJECT="www" 
CONTENT_TYPE="text/html" 
encoding="utf-8";
ODS LISTING CLOSE;
ODS HTML BODY=mail;
 proc odstext;
 heading 'My Report' /Style=Header {fontsize=16pt  color=blue  fontstyle=italic};
 p 'Hello, please find my report below.';
 p '';
 p '';
 p '';
 p '';
 p 'Kind Regards,';
 p 'Dave';
run;
title;
Title 'Cars';
proc report data = SasHelp.Cars(obs = 5) split = "*";
   column Type MPG_Ratio MPG_City MPG_Highway;
   define Type / display ;
   define MPG_City / display;
   define MPG_Highway / display;
   define MPG_Ratio / computed 'City/Highway' format = 4.2;
   compute MPG_Highway;   
      MPG_Ratio = MPG_City/MPG_Highway;
   endcomp;
run;
title;
Title 'class';
proc report data = SasHelp.class(obs = 5);
run;
ODS HTML CLOSE;
ODS LISTING;

 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 06:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/send-email-from-SAS-add-reports-and-text-in-body-of-email/m-p/851889#M336740</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2023-01-03T06:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: send email from SAS-add reports and text in body of email</title>
      <link>https://communities.sas.com/t5/SAS-Programming/send-email-from-SAS-add-reports-and-text-in-body-of-email/m-p/851942#M336756</link>
      <description>&lt;P&gt;SAS remembers your TITLE setting unless you clear it between runs, so end your program with an empty&amp;nbsp;&lt;STRONG&gt;TITLE;&lt;/STRONG&gt; statement to clear the "Class" title.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regarding the boxes, that's part of the ODS style. You can experiment with different styles and tagsets, or use PROC TEMPLATE to adjust. Example:&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;ods path(prepend) work.template(update);
proc template;
	define style styles.myemail;
		parent=styles.seaside;
			class body /	
				htmlstyle="border:none";
		        class systitleandfootercontainer /
            	                htmlstyle="border:none";
			class page /
				htmlstyle="border:none";
	end;
run;
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;Then use this in your ODS HTML:&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;ODS HTML BODY=email style=myemail;&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 03 Jan 2023 12:52:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/send-email-from-SAS-add-reports-and-text-in-body-of-email/m-p/851942#M336756</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2023-01-03T12:52:22Z</dc:date>
    </item>
  </channel>
</rss>

