<?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: About email from SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/About-email-from-SAS/m-p/310827#M67068</link>
    <description>&lt;P&gt;You almost never need %sysfunc inside a data step. The purpose of %sysfunc is to call a data step Function in macro code outside of a data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;Check= &lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;fileexist(C:temp/test.csv&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Nov 2016 23:30:30 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-11-10T23:30:30Z</dc:date>
    <item>
      <title>About email from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/About-email-from-SAS/m-p/310820#M67064</link>
      <description>&lt;P&gt;I am not sure what is wrong with the code. I want to check whether the file exist in the directory. and if it exists then just write it to the log, else send an email.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is sending an email to be whether the file is present or not. If the file is present, it is sending an email without the body part. If not present, it is going through the loop. What is that I am missing here?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;filename mailbox email 'sashelp@outlook.com" subject: missing file&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; Check= &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;(fileexist(C:temp/test.csv&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;));&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; if Check=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; then do;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;file mailbox;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; PUT &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Hello,"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; PUT &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Please check the directory. The file is missing."&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; PUT &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Thanks."&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; else if Check=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; then do;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; put &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Note: File Exists: "&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;Run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Dev Lama&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2016 23:09:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/About-email-from-SAS/m-p/310820#M67064</guid>
      <dc:creator>devnand</dc:creator>
      <dc:date>2016-11-10T23:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: About email from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/About-email-from-SAS/m-p/310822#M67065</link>
      <description>&lt;P&gt;Move the file statement out of the IF condition? Though I didn't think it was a conditional statement (ie executed regardless of where it is). Maybe I don't understand your problem though.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2016 23:13:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/About-email-from-SAS/m-p/310822#M67065</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-10T23:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: About email from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/About-email-from-SAS/m-p/310827#M67068</link>
      <description>&lt;P&gt;You almost never need %sysfunc inside a data step. The purpose of %sysfunc is to call a data step Function in macro code outside of a data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;Check= &lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;fileexist(C:temp/test.csv&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2016 23:30:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/About-email-from-SAS/m-p/310827#M67068</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-11-10T23:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: About email from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/About-email-from-SAS/m-p/310842#M67071</link>
      <description>&lt;P&gt;Hi Dev,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;your code seems fine, but few changes could help you get the expected email.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please try the below code which I modified taking your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename mailbox email to='sashelp@outlook.com' subject= 'missing file';

data _null_;

Check=fileexist('C:temp/test.csv');

if Check=0 then do;

file mailbox;

PUT "Hello,";

PUT "Please check the directory. The file is missing.";

PUT "Thanks.";

end;

else if Check=1 then do;

put "Note: File Exists: " ;

end;

Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Nov 2016 02:28:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/About-email-from-SAS/m-p/310842#M67071</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2016-11-11T02:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: About email from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/About-email-from-SAS/m-p/310844#M67072</link>
      <description>&lt;P&gt;The logic that I am trying to implement is that when the file exist in that folder, do not send the email, but if the file does not exist please send the email.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even when the file is present, the email is getting triggered.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Dev Lama&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2016 03:02:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/About-email-from-SAS/m-p/310844#M67072</guid>
      <dc:creator>devnand</dc:creator>
      <dc:date>2016-11-11T03:02:25Z</dc:date>
    </item>
  </channel>
</rss>

