<?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 in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Send-email-from-sas/m-p/510857#M73019</link>
    <description>Hi:&lt;BR /&gt;  Every PUT; statement in your code is writing a blank line. So inside your DO loop, you have a put; that will be written each time through the loop. Then you have extra put; statements after the Hello and before and after the lines.&lt;BR /&gt;&lt;BR /&gt;The first thing I'd recommend is remove a few of the &lt;BR /&gt;put; &lt;BR /&gt;statements that you have and see whether that improves your spacing.&lt;BR /&gt;Cynthia</description>
    <pubDate>Tue, 06 Nov 2018 19:03:28 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2018-11-06T19:03:28Z</dc:date>
    <item>
      <title>Send email from sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Send-email-from-sas/m-p/510844#M73017</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have table containing email address , name and names of files. I have to sand an email to each person and writing down the list of files' names.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fileexample.png" style="width: 531px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24713i80B0260056AAD66A/image-dimensions/531x298?v=v2" width="531" height="298" role="button" title="fileexample.png" alt="fileexample.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I created a macro %putt that can do what I'm looking for.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename MYEMAIL email;
 data _null_;
 set password_name_path;
  file MYEMAIL;
	%MACRO PUTT(NBR);
	%DO I = 1 %TO &amp;amp;NBR;
	 PUT  file&amp;amp;I ; 
	 put ;
	%END;
	%MEND PUTT;
 put '!EM_TO!' mail;
 put '!EM_FROM!' "XXX@gmail.com";
 /*put '!EM_CC!' " ";*/
 put '!EM_SUBJECT! File’sname  ' ;
 put "Hello "name "," ; 
 put ;
 put "======================================================================================================";

 put ;
 put "the names files are :" ;
 put ;
 %PUTT(&amp;amp;maxfile);
 put ;
 
 put "======================================================================================================";
 put '!EM_SEND!';
 put '!EM_NEWMSG!';
 put '!EM_ABORT!';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;amp;maxfile is a macro variable which has the max value of numbers of file. 4 in the example above.&lt;/P&gt;&lt;P&gt;The program works properly but I have 4 lines for each email sent by SAS.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mail.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24715i8F7406813B5D0BB5/image-size/large?v=v2&amp;amp;px=999" role="button" title="mail.png" alt="mail.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can anyone help me how to put avoid printing black lines when we have only some files (file1, file2 for exp).&lt;/P&gt;&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Nov 2018 18:10:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Send-email-from-sas/m-p/510844#M73017</guid>
      <dc:creator>Nihal</dc:creator>
      <dc:date>2018-11-06T18:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: Send email from sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Send-email-from-sas/m-p/510857#M73019</link>
      <description>Hi:&lt;BR /&gt;  Every PUT; statement in your code is writing a blank line. So inside your DO loop, you have a put; that will be written each time through the loop. Then you have extra put; statements after the Hello and before and after the lines.&lt;BR /&gt;&lt;BR /&gt;The first thing I'd recommend is remove a few of the &lt;BR /&gt;put; &lt;BR /&gt;statements that you have and see whether that improves your spacing.&lt;BR /&gt;Cynthia</description>
      <pubDate>Tue, 06 Nov 2018 19:03:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Send-email-from-sas/m-p/510857#M73019</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-11-06T19:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Send email from sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Send-email-from-sas/m-p/510870#M73020</link>
      <description>&lt;P&gt;Thank you for your answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You're right. But what I'm asking for is how to write a code to tell sas to put file1 and stops instead of putting 3 blank lines.&lt;/P&gt;&lt;P&gt;Note : the value of macro variable "&amp;amp;maxfile" =4&lt;/P&gt;&lt;P&gt;May be adding a do loop?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Nov 2018 19:28:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Send-email-from-sas/m-p/510870#M73020</guid>
      <dc:creator>Nihal</dc:creator>
      <dc:date>2018-11-06T19:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Send email from sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Send-email-from-sas/m-p/510872#M73021</link>
      <description>Why you have a macro embedde in a data step. That likely is not a good idea. It makes things confusing is one reason, the other is it makes it difficult to debug. Why are you looking 4 times if you have only one file? Either modify the loop or add an %IF/%THEN afterwards to check if the macro variable has a value before displaying it. You can finding some examples in the Macro Appendix in the documentation.</description>
      <pubDate>Tue, 06 Nov 2018 19:40:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Send-email-from-sas/m-p/510872#M73021</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-06T19:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: Send email from sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Send-email-from-sas/m-p/510901#M73028</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/181470"&gt;@Nihal&lt;/a&gt;, here's an alternative just listing the filenames on one row.&amp;nbsp; When I have short emails like this I also put the same information in the subject line so that I don't even have to open the email.&amp;nbsp; In the put statements, the / tells SAS to go to a new line (making a blank line).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;filename MYEMAIL email;
 data _null_;
 set password_name_path;
 maxfile = CATX(' ', file1, file2, file3, file4);
 file MYEMAIL;
 put '!EM_TO!' mail;
 put '!EM_FROM!' "XXX@gmail.com";
 put '!EM_SUBJECT!' 'the names files are: ' maxfile ;
 put "Hello " name "," ;
 put / "======================================================================================================";
 put / "the names files are: " maxfile ;
 put / "======================================================================================================";
 put '!EM_SEND!';
 put '!EM_NEWMSG!';
 put '!EM_ABORT!';
run;
&lt;/PRE&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Nov 2018 21:05:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Send-email-from-sas/m-p/510901#M73028</guid>
      <dc:creator>DaveHorne</dc:creator>
      <dc:date>2018-11-06T21:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: Send email from sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Send-email-from-sas/m-p/510908#M73029</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/181470"&gt;@Nihal&lt;/a&gt;, here's another version with the files listed on separate lines (and I used the shortcut notation for the dashed lines):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename MYEMAIL email;
 data _null_;
 set password_name_path;
 maxfile = CATX(' ', file1, file2, file3, file4);
 file MYEMAIL;
 put '!EM_TO!' mail;
 put '!EM_FROM!' "XXX@gmail.com";
 put '!EM_SUBJECT!' 'the names files are: ' maxfile ;
 put "Hello " name "," ;
 put / 30*"=";
 put / "The names files are:";
 if file1 &amp;gt; '' then put / file1;   
 if file2 &amp;gt; '' then put / file2;   
 if file3 &amp;gt; '' then put / file3;   
 if file4 &amp;gt; '' then put / file4;   
 put / 30*"=";
 put '!EM_SEND!';
 put '!EM_NEWMSG!';
 put '!EM_ABORT!';
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Nov 2018 21:24:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Send-email-from-sas/m-p/510908#M73029</guid>
      <dc:creator>DaveHorne</dc:creator>
      <dc:date>2018-11-06T21:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: Send email from sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Send-email-from-sas/m-p/511168#M73048</link>
      <description>&lt;P&gt;Hi @&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/100" target="_self"&gt;&lt;SPAN&gt;DaveHorne&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for this easy solution.&lt;/P&gt;&lt;P&gt;Its works&lt;/P&gt;&lt;P&gt;Nihal&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 19:46:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Send-email-from-sas/m-p/511168#M73048</guid>
      <dc:creator>Nihal</dc:creator>
      <dc:date>2018-11-07T19:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Send email from sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Send-email-from-sas/m-p/511176#M73049</link>
      <description>You should mark Dave’s solution as the answer, not your response.</description>
      <pubDate>Wed, 07 Nov 2018 20:01:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Send-email-from-sas/m-p/511176#M73049</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-07T20:01:23Z</dc:date>
    </item>
  </channel>
</rss>

