<?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: Error with empty attach variable in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Error-with-empty-attach-variable/m-p/519141#M73353</link>
    <description>It really worked. Thank you:)</description>
    <pubDate>Thu, 06 Dec 2018 14:52:28 GMT</pubDate>
    <dc:creator>ankit1may</dc:creator>
    <dc:date>2018-12-06T14:52:28Z</dc:date>
    <item>
      <title>Error with empty attach variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-with-empty-attach-variable/m-p/519119#M73351</link>
      <description>Hello all,&lt;BR /&gt;I am quite new to SAS and is facing challenge with respect to emails sent with SAS code.&lt;BR /&gt;I have to send an email "Good Day" , when there are no files to attach, and if there are any files, I have to attach the file in the email . All files needed to be attached are put in macro variable &amp;amp;all_files. I have defined a control variable &amp;amp;bha, which if 0, would mean that there are no files to attach, but if it is greater than 0, there are files to attach. The problem is , when I don't have any files to attach, the variable &amp;amp;all_files = '', and the code is giving error in attach statement. My coffee is below:&lt;BR /&gt;&lt;BR /&gt;Filename outbox 'abc@xyz.com';&lt;BR /&gt;&lt;BR /&gt;Data _null_;&lt;BR /&gt;If &amp;amp;bha =0 then do;&lt;BR /&gt;File outbox&lt;BR /&gt;From = my mail&lt;BR /&gt;To = xxx&lt;BR /&gt;Subject = 'reports';&lt;BR /&gt;Put 'Good Day';&lt;BR /&gt;End;&lt;BR /&gt;&lt;BR /&gt;Else if &amp;amp;bha ne 0 then do;&lt;BR /&gt;File outbox&lt;BR /&gt;From = my mail&lt;BR /&gt;To = xxx&lt;BR /&gt;Subject = 'reports'&lt;BR /&gt;Attach= (&amp;amp;all_files);&lt;BR /&gt;Put 'attach are reports';&lt;BR /&gt;End;&lt;BR /&gt;Run;&lt;BR /&gt;&lt;BR /&gt;Whenever there are no files to send, the code gives me error 'invalid value for the attach option'.&lt;BR /&gt;&lt;BR /&gt;Can someone please help?&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Dec 2018 14:03:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-with-empty-attach-variable/m-p/519119#M73351</guid>
      <dc:creator>ankit1may</dc:creator>
      <dc:date>2018-12-06T14:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: Error with empty attach variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-with-empty-attach-variable/m-p/519135#M73352</link>
      <description>&lt;P&gt;Email from dataset is not switchable like that, you would need to wrap it in macro, something like:&lt;/P&gt;
&lt;PRE&gt;%macro SendMail (bha=);

  data _null_;
    %if &amp;amp;bha.=0 %then %do;
      file outbox from=mymail to=xxx subject='reports';
      put 'Good Day';
    %end;
    %else %do;
      file outbox from=mymail  to=xxx subject='reports' attach=(&amp;amp;all_files.);
      put 'attach are reports';
    %end;
  run;

%mend SendMail;

%SendMail (bha=1);   /* For no reports, just change 1 to 0 */&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Dec 2018 14:41:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-with-empty-attach-variable/m-p/519135#M73352</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-12-06T14:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: Error with empty attach variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-with-empty-attach-variable/m-p/519141#M73353</link>
      <description>It really worked. Thank you:)</description>
      <pubDate>Thu, 06 Dec 2018 14:52:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-with-empty-attach-variable/m-p/519141#M73353</guid>
      <dc:creator>ankit1may</dc:creator>
      <dc:date>2018-12-06T14:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: Error with empty attach variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-with-empty-attach-variable/m-p/519318#M73354</link>
      <description>&lt;P&gt;There are various substitutions that cannot be used as a parameter expansion. You have to map the root directory as well as you have to make sure that name will not be used in the directory name.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For more access &lt;A href="http://www.uaewebsitedevelopment.com/best-wordpress-plugins-for-seo/" target="_self"&gt;plugins uae&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Dec 2018 23:30:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-with-empty-attach-variable/m-p/519318#M73354</guid>
      <dc:creator>mark1221</dc:creator>
      <dc:date>2018-12-06T23:30:29Z</dc:date>
    </item>
  </channel>
</rss>

