<?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: Sending email - file in use error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sending-email-file-in-use-error/m-p/455099#M115094</link>
    <description>&lt;P&gt;Please supply the whole log of the macro, so we can see the message(s) and the missing macro code.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Apr 2018 10:37:26 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-04-18T10:37:26Z</dc:date>
    <item>
      <title>Sending email - file in use error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sending-email-file-in-use-error/m-p/455093#M115088</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;sending email I reveive file in use error on lib.loaded, could anyone plese tell me what`s that mean, and how to handle it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Filename mymail email
    From="example@mail.com"
    Sender="example@mail.com"
    to=( "example@mail.com")
    type='text/html'
    %if     &amp;amp;left_count &amp;gt;0 %then %do;
        Subject="Warning: &amp;amp;Process_name has been finished %sysfunc(putn(%sysfunc(today()),DDMMYYS10.))" encoding=LATIN2;
    %end;
    %if     &amp;amp;left_count=0 %then %do;
        Subject="OK:&amp;amp;Process_name has been finished %sysfunc(putn(%sysfunc(today()),DDMMYYS10.))%sysfunc(putn(%sysfunc(today()),DDMMYYS10.))" encoding=LATIN2;
    %end;

        Data _null_;
            file mymail;
            ods html body=mymail;
            ods text= "Some message" ;
           proc print data=lib.loaded(where=(data_danych=%sysfunc(today())) rename=(importowane="Wczytane  pliki"n));
            var "Wczytane pliki"n;
            run;
            %if     &amp;amp;left_count &amp;gt;0 %then %do;
            ods text= "Some message ";
            proc print data=lib.listed_left;
            run;    
            %end;
            ods text= "Some message";
            ods html close ;
        Run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 09:45:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sending-email-file-in-use-error/m-p/455093#M115088</guid>
      <dc:creator>Matt3</dc:creator>
      <dc:date>2018-04-18T09:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: Sending email - file in use error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sending-email-file-in-use-error/m-p/455099#M115094</link>
      <description>&lt;P&gt;Please supply the whole log of the macro, so we can see the message(s) and the missing macro code.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 10:37:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sending-email-file-in-use-error/m-p/455099#M115094</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-18T10:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: Sending email - file in use error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sending-email-file-in-use-error/m-p/455100#M115095</link>
      <description>&lt;P&gt;There is a whole raft of issues in that code.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First off you have procedure calls within a datastep which is invalid (proc print within data _null_;&lt;/P&gt;
&lt;P&gt;Next up you have macro code in open code - i.e. the macro code is not within a macro.&lt;/P&gt;
&lt;P&gt;As such it needs a re-write.&amp;nbsp; To start with:&lt;/P&gt;
&lt;PRE&gt;%macro em ();

  filename...;

%mend em;

%em;&lt;/PRE&gt;
&lt;P&gt;One your code is within a macro then the macro code can evaluate.&amp;nbsp; So the %if's will work.&lt;/P&gt;
&lt;P&gt;Next up this part:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;           &lt;SPAN class="token statement"&gt;ods&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;html&lt;/SPAN&gt; body&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;mymail&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Unitl the close, needs to be its own block, and added.&amp;nbsp; Check this example:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/23/636.html&amp;nbsp;" target="_blank"&gt;http://support.sas.com/kb/23/636.html&amp;nbsp;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 10:42:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sending-email-file-in-use-error/m-p/455100#M115095</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-18T10:42:03Z</dc:date>
    </item>
  </channel>
</rss>

