<?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: Macro for mailing on specific day doesn't work? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/578018#M13287</link>
    <description>&lt;P&gt;Thanks for your efforts and time, Kurt.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;After every change to macro code, make sure that the macro definition is actually submitted.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do you mean by this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;And how do I make sure it is submitted?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What I Already did now&lt;/STRONG&gt;:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Already closed my sas-program and rerun it. But no luck.. still no email&amp;nbsp;&lt;/P&gt;&lt;P&gt;Closed it again. Changed the filename in the macro code form mail0 to mail1... rerun it...&lt;/P&gt;&lt;P&gt;But still no luck here.. sorry.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jul 2019 11:41:09 GMT</pubDate>
    <dc:creator>SAS_Question</dc:creator>
    <dc:date>2019-07-31T11:41:09Z</dc:date>
    <item>
      <title>Macro for mailing on specific day doesn't work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/577328#M13186</link>
      <description>&lt;P&gt;Hello my friends,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone analyse my code and tell me why SAS doens't mail on monday? This is the code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
rest of code...
*/


%Macro exporteer;
proc export data=work.verschillend 
				outfile="&amp;amp;Uitvoer.\Volher_Rundate[&amp;amp;dat1.].txt" 
				dbms=tab replace;
	*putnames=no;
run;
%Mend exporteer;


%MACRO mailen;
%let adres = "someone@sas.nl" , "other@sas.nl"; /* I use fake email addresses here, but in real code the real email is used! */

FILENAME mail0 EMAIL  
	To=(&amp;amp;adres)
	SUBJECT="Some subject" 
	from   ="NOREPLY &amp;lt;NOREPLY@sas.nl&amp;gt;"        
	Type   ="text/plain" 
	Attach =("&amp;amp;Uitvoer.\Volher_Rundate[&amp;amp;dat1.].txt") 
	Replyto="ME &amp;lt;me@sas.nl&amp;gt;";

Data _null_;
	file mail0;
	put "some text"; 
	put " ";
	put " ";
	put " ";
	put " ";
	put "Some more text";
	put "Final text";
run;
%MEND mailen;

/*Mailen van txt bestand - alleen op maandag!*/
%MACRO mail_als;
	%If %SYSFUNC(WEEKDAY(%SYSFUNC(TODAY()))) = 2 %then /* 2 = monday = mailing day */
		%do;
			%exporteer; /*this works!*/
			
			%mailen; /*this doesn't work - only if put outside macro, but in macro it won't work?? why?? */
		%END ;
%MEND mail_als;

%mail_als;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;And this is what is should do&lt;/STRONG&gt;:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It should export a txt file only on each monday (which works well) and then email this exported file (also only echa monday). But this doensn't work? It doesn't email it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What i did to solve already&lt;/STRONG&gt;:&amp;nbsp;&lt;/P&gt;&lt;P&gt;I put the macro code for emailing outside the macro, and then it emails the file. But i don't want that, because then the program will email it everytime the code runs. That is not what i want.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope someone can solve it for me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;TiA!&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 12:07:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/577328#M13186</guid>
      <dc:creator>SAS_Question</dc:creator>
      <dc:date>2019-07-29T12:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for mailing on specific day doesn't work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/577341#M13188</link>
      <description>&lt;P&gt;Please post the log of the macro call; use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint mlogic symbolgen;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to activate all macro debugging helpers.&lt;/P&gt;
&lt;P&gt;Please use the {i} button for posting the log.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 13:42:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/577341#M13188</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-29T13:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for mailing on specific day doesn't work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/577981#M13274</link>
      <description>&lt;P&gt;Hi Kurt,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the macro log output:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;MLOGIC(MAILEN):  Beginning execution.
MLOGIC(MAILEN):  %LET (variable name is adres)
MLOGIC(MAILEN):  %LET (variable name is adres)
MPRINT(MAILEN):   * FILENAME mail0 EMAIL To=(&amp;amp;adres) SUBJECT="Some subject" from ="NOREPLY &amp;lt;NOREPLY@sas.nl&amp;gt;" Type ="text/plain" Attach
=("&amp;amp;Uitvoer.\VolHer_Rundate[&amp;amp;dat1.].txt") Replyto="ME &amp;lt;me@sas.nl&amp;gt;";
MPRINT(MAILEN):   Data _null_;
MPRINT(MAILEN):   file mail0;
MPRINT(MAILEN):   put "Some text";
MPRINT(MAILEN):   put " ";
MPRINT(MAILEN):   put " ";
MPRINT(MAILEN):   put " ";
MPRINT(MAILEN):   put " ";
MPRINT(MAILEN):   put "Some more text.";
MPRINT(MAILEN):   put "Final text.";
MPRINT(MAILEN):   run;

NOTE: The file MAIL0 is:
      Filename=\\Client\J$\some\dir\on\network\mail0.dat,
      RECFM=V,LRECL=32767,File Size (bytes)=0,
      Last Modified=31 juli 2019 10:18:04 uur,
      Create Time=31 juli 2019 10:18:04 uur

NOTE: 7 records were written to the file MAIL0.
      The minimum record length was 1.
      The maximum record length was 79.
NOTE: DATA statement used (Total process time):
      real time           0.06 seconds
      cpu time            0.01 seconds

MLOGIC(MAILEN):  Ending execution.
MPRINT(MAIL_ALS):  ;
MLOGIC(MAIL_ALS):  Ending execution.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Still no idea why this doesn't work in a macro... &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 08:55:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/577981#M13274</guid>
      <dc:creator>SAS_Question</dc:creator>
      <dc:date>2019-07-31T08:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for mailing on specific day doesn't work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/577988#M13275</link>
      <description>&lt;P&gt;See this:&lt;/P&gt;
&lt;PRE&gt;MPRINT(MAILEN):   * FILENAME mail0 EMAIL To=(&amp;amp;adres) SUBJECT="Some subject" from ="NOREPLY &amp;lt;NOREPLY@sas.nl&amp;gt;" Type ="text/plain" Attach
=("&amp;amp;Uitvoer.\VolHer_Rundate[&amp;amp;dat1.].txt") Replyto="ME &amp;lt;me@sas.nl&amp;gt;";&lt;/PRE&gt;
&lt;P&gt;Note the asterisk. The filename statement is commented out, so a previous filename with a physical filename (from testing?) is active and used:&lt;/P&gt;
&lt;PRE&gt;NOTE: The file MAIL0 is:
      Filename=\\Client\J$\some\dir\on\network\mail0.dat,
&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Jul 2019 09:08:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/577988#M13275</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-31T09:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for mailing on specific day doesn't work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/577989#M13276</link>
      <description>&lt;P&gt;I deleted the mail0(.dat) file on the network disk/map but still SAS doesn't email the file to me?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I still don't understand this error... sorry.&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>Wed, 31 Jul 2019 09:44:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/577989#M13276</guid>
      <dc:creator>SAS_Question</dc:creator>
      <dc:date>2019-07-31T09:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for mailing on specific day doesn't work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/577993#M13277</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/195211"&gt;@SAS_Question&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I deleted the mail0(.dat) file on the network disk/map but still SAS doesn't email the file to me?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I still don't understand this error... sorry.&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;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That won't help. You have to un-comment the filename mail statement.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 10:07:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/577993#M13277</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-31T10:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for mailing on specific day doesn't work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/577996#M13279</link>
      <description>&lt;P&gt;But I didn't commented it out in the code? See the picture:&amp;nbsp;&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="mail uncommented.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31432i7B326052FC0B941F/image-size/large?v=v2&amp;amp;px=999" role="button" title="mail uncommented.png" alt="mail uncommented.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 10:12:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/577996#M13279</guid>
      <dc:creator>SAS_Question</dc:creator>
      <dc:date>2019-07-31T10:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for mailing on specific day doesn't work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/577997#M13280</link>
      <description>&lt;P&gt;Your LOG tells otherwise.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 10:19:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/577997#M13280</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-31T10:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for mailing on specific day doesn't work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/577999#M13282</link>
      <description>&lt;P&gt;PS what you see in your code doesn't have to be what SAS has stored as a compiled macro. After every change to macro code, make sure that the macro definition is actually submitted.&lt;/P&gt;
&lt;P&gt;If in doubt, terminate your SAS session, start a new one, and submit the macro definition and the macro call in immediate succession.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 10:29:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/577999#M13282</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-31T10:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for mailing on specific day doesn't work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/578018#M13287</link>
      <description>&lt;P&gt;Thanks for your efforts and time, Kurt.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;After every change to macro code, make sure that the macro definition is actually submitted.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do you mean by this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;And how do I make sure it is submitted?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What I Already did now&lt;/STRONG&gt;:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Already closed my sas-program and rerun it. But no luck.. still no email&amp;nbsp;&lt;/P&gt;&lt;P&gt;Closed it again. Changed the filename in the macro code form mail0 to mail1... rerun it...&lt;/P&gt;&lt;P&gt;But still no luck here.. sorry.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 11:41:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/578018#M13287</guid>
      <dc:creator>SAS_Question</dc:creator>
      <dc:date>2019-07-31T11:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for mailing on specific day doesn't work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/578022#M13289</link>
      <description>&lt;P&gt;Start a new SAS session.&lt;/P&gt;
&lt;P&gt;Run this code (and NOTHING else!); only replace XXXX with your email:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let adres = "XXXX";

%Macro exporteer;
%put exporteer running;
%Mend exporteer;


%MACRO mailen;


FILENAME mail0 EMAIL  
	To=(&amp;amp;adres)
	SUBJECT="Some subject" 
	from   ="NOREPLY &amp;lt;NOREPLY@sas.nl&amp;gt;"        
	Type   ="text/plain" 
;

Data _null_;
	file mail0;
	put "some text"; 
	put " ";
	put " ";
	put " ";
	put " ";
	put "Some more text";
	put "Final text";
run;
%MEND mailen;

%MACRO mail_als;
	%If %SYSFUNC(WEEKDAY(%SYSFUNC(TODAY()))) = 4 %then 
		%do;
			%exporteer;			
			%mailen;
		%END ;
%MEND mail_als;

options mprint mlogic symbolgen;

%mail_als;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;My log from this code:&lt;/P&gt;
&lt;PRE&gt;24         %let adres = "XXXX";
25         
26         %Macro exporteer;
27         %put exporteer running;
28         %Mend exporteer;
29         
30         
31         %MACRO mailen;
32         
33         
34         FILENAME mail0 EMAIL
35         	To=(&amp;amp;adres)
36         	SUBJECT="Some subject"
37         	from   ="NOREPLY &amp;lt;NOREPLY@sas.nl&amp;gt;"
38         	Type   ="text/plain"
39         ;
40         
41         Data _null_;
42         	file mail0;
43         	put "some text";
44         	put " ";
45         	put " ";
46         	put " ";
47         	put " ";
48         	put "Some more text";
49         	put "Final text";
50         run;
51         %MEND mailen;
52         
53         %MACRO mail_als;
54         	%If %SYSFUNC(WEEKDAY(%SYSFUNC(TODAY()))) = 4 %then
55         		%do;
56         			%exporteer;			
57         			%mailen;
2                                                          Das SAS System                             14:00 Wednesday, July 31, 2019

58         		%END ;
59         %MEND mail_als;
60         
61         options mprint mlogic symbolgen;
62         
63         %mail_als;
MLOGIC(MAIL_ALS):  Ausführung beginnt.
MLOGIC(MAIL_ALS):  %IF-Bedingung %SYSFUNC(WEEKDAY(%SYSFUNC(TODAY()))) = 4 ist TRUE
MLOGIC(EXPORTEER):  Ausführung beginnt.
MLOGIC(EXPORTEER):  %PUT exporteer running
exporteer running
MLOGIC(EXPORTEER):  Ausführung wird beendet.
MPRINT(MAIL_ALS):  ;
MLOGIC(MAILEN):  Ausführung beginnt.
SYMBOLGEN:  Makrovariable ADRES wird in "XXXX" aufgelöst
MPRINT(MAILEN):   FILENAME mail0 EMAIL To=("XXXX") SUBJECT="Some subject" from ="NOREPLY &amp;lt;NOREPLY@sas.nl&amp;gt;" Type 
="text/plain" ;
MPRINT(MAILEN):   Data _null_;
MPRINT(MAILEN):   file mail0;
MPRINT(MAILEN):   put "some text";
MPRINT(MAILEN):   put " ";
MPRINT(MAILEN):   put " ";
MPRINT(MAILEN):   put " ";
MPRINT(MAILEN):   put " ";
MPRINT(MAILEN):   put "Some more text";
MPRINT(MAILEN):   put "Final text";
MPRINT(MAILEN):   run;

NOTE: The file MAIL0 is:
      E-Mail-Zugriffskomponente

Nachricht gesendet
      An:          "XXXX"
      Cc:          
      Bcc:         
      Betreff:     Some subject
      Anhänge: 
NOTE: 7 records were written to the file MAIL0.
      The minimum record length was 1.
      The maximum record length was 14.
NOTE: DATA statement used (Total process time):
      real time           0.06 seconds
      cpu time            0.00 seconds
      

MLOGIC(MAILEN):  Ausführung wird beendet.
MPRINT(MAIL_ALS):  ;
MLOGIC(MAIL_ALS):  Ausführung wird beendet.
&lt;/PRE&gt;
&lt;P&gt;The email arrived as wanted.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 12:05:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/578022#M13289</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-31T12:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for mailing on specific day doesn't work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/578045#M13290</link>
      <description>&lt;P&gt;Thank you Kurt. I tried the code like this, (added the attachment too - a txt file):&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let adres = "mymail@somehost.nl";

%Macro exporteer;
%put exporteer running;
%Mend exporteer;


%MACRO mailen;


FILENAME mail0 EMAIL  
	To=(&amp;amp;adres)
	SUBJECT="Some subject" 
	from   ="NOREPLY &amp;lt;NOREPLY@sas.nl&amp;gt;"        
	Type   ="text/plain" 
	Attach =("J:\some\dir\to\the\exported\file.txt") 
;

Data _null_;
	file mail0;
	put "some text"; 
	put " ";
	put " ";
	put " ";
	put " ";
	put "Some more text";
	put "Final text";
run;
%MEND mailen;

%MACRO mail_als;
	%If %SYSFUNC(WEEKDAY(%SYSFUNC(TODAY()))) = 4 %then 
		%do;
			%exporteer;			
			%mailen;
		%END ;
%MEND mail_als;

options mprint mlogic symbolgen;

%mail_als;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And this works?!!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I still don't know why this works and the orginal code doesn't work?&lt;/P&gt;&lt;P&gt;What is the difference then?&amp;nbsp;&lt;BR /&gt;Will have to start all over then... if no one knows why. I really don't understand this one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 12:59:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/578045#M13290</guid>
      <dc:creator>SAS_Question</dc:creator>
      <dc:date>2019-07-31T12:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for mailing on specific day doesn't work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/578060#M13291</link>
      <description>&lt;P&gt;Keep your original code that failed, for later reference.&lt;/P&gt;
&lt;P&gt;Take this code that works, and expand it step-by-step; test with everything you want it to do.&lt;/P&gt;
&lt;P&gt;If at some point it stops working, you have a clue. If you come through without problems, compare your preserved original code with the new one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I still think the asterisk in your log (indicating a comment statement) was a remnant of testing, and you missed to submit a changed macro definition. (submit: mark the macro code, and select "Run Selection" from the menu)&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 13:15:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/578060#M13291</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-31T13:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for mailing on specific day doesn't work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/578345#M13340</link>
      <description>&lt;P&gt;Thank you Kurt, will try this out next week. This week I'm very busy yet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;As soon as I tried it I will let you know if it works. Thanks so far and have a nice day!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 11:30:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/578345#M13340</guid>
      <dc:creator>SAS_Question</dc:creator>
      <dc:date>2019-08-01T11:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for mailing on specific day doesn't work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/578346#M13341</link>
      <description>&lt;P&gt;Take your time. I won't be in front of my SAS again before Tuesday, anyway.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 11:32:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/578346#M13341</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-08-01T11:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for mailing on specific day doesn't work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/579294#M13438</link>
      <description>&lt;P&gt;&amp;nbsp;Hi Kurt,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just to let you know: it works now...&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I think it went wrong because when I used the program it sometime freezed and when I force close it, it doesn't email anymore...&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I needed to restart the whole SAS-server before it can be used again. Very strange. But that clears the '*' before FILENAME in the macro output I guess... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now all good. Thanks for your time and efforts!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2019 08:23:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/579294#M13438</guid>
      <dc:creator>SAS_Question</dc:creator>
      <dc:date>2019-08-06T08:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for mailing on specific day doesn't work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/579296#M13439</link>
      <description>&lt;P&gt;A process hanging with the pipe to the mailer open can cause the mailer to become unresponsive (it only has one input channel).&lt;/P&gt;
&lt;P&gt;"Force closing" a SAS process from the client side should always be accompanied by a search for the server process (on the server), and if found, killing that process. Running &lt;FONT face="courier new,courier"&gt;cleanwork&lt;/FONT&gt; after is recommended, of course.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2019 08:32:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/579296#M13439</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-08-06T08:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for mailing on specific day doesn't work?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/579298#M13441</link>
      <description>&lt;P&gt;Interesting! Thanks for the tip about the SAS CLEANWORK utility. Very handy to know.&amp;nbsp;Will dive into that!&lt;/P&gt;&lt;P&gt;Thanks again Kurt!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2019 08:43:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-for-mailing-on-specific-day-doesn-t-work/m-p/579298#M13441</guid>
      <dc:creator>SAS_Question</dc:creator>
      <dc:date>2019-08-06T08:43:20Z</dc:date>
    </item>
  </channel>
</rss>

