<?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 emails from sas using macro and mulipe if statements in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas-using-macro-and-mulipe-if-statements/m-p/524877#M32782</link>
    <description>&lt;P&gt;Looks to me like none of your %if conditions is fulfilled. Inspect macro variable the_run.&lt;/P&gt;</description>
    <pubDate>Sun, 06 Jan 2019 10:44:54 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-01-06T10:44:54Z</dc:date>
    <item>
      <title>sending emails from sas using macro and mulipe if statements</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas-using-macro-and-mulipe-if-statements/m-p/524875#M32781</link>
      <description>&lt;P&gt;hey everybody,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;STRONG&gt;I would like to send an email with multiple files&amp;nbsp; and I am trying to do that with "macro"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;the email should be send according to the time of the year.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;for example I have some files that should be send once in a quarter and other file once in a half year;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
dt=intnx('month',date(),0,'S');
ind=month(dt);
if ind in (3,5,9,11) then the_run='Dual';
if ind in(4,10) then the_run='Quarterly';
if ind in (1,7) then the_run='hdq';
call symput('the_run',the_run);
run;

%put &amp;amp;the_run.;


%macro emailm;
%if "&amp;amp;the_run."="hdq" %then %do; 
filename TestR email to = ("jonathan.chen@poalim.co.il") 
SUBJECT=" %SYSFUNC(date(), YYMMdd10.)צ'ק ליסט דו חודשי לתאריך "
type='text/html'
attach=("&amp;amp;path\SHOTEF_MNG_SNIF_MNG_PRATIT_&amp;amp;the_month&amp;amp;format" content_type="application/xlsx"
"&amp;amp;path\CHECK_LIST_CONNECT_&amp;amp;the_month&amp;amp;format" content_type="application/xlsx") 
encoding='whebrew';

data _null_;
file TestR;
run;
%end;
%else %if "&amp;amp;the_run."="Quarterly" %then %do;
/*שליחת קבצים של הרצה רבעונית*/
filename TestR email to = ("jonathan.chen@poalim.co.il")
cc= ("jonathan.chen@poalim.co.il")
SUBJECT=" %SYSFUNC(date(), YYMMdd10.)צ'ק ליסט רבעוני לתאריך "
type='text/html'
attach=("&amp;amp;path\CHECK_LIST_PLAT_&amp;amp;the_month&amp;amp;format" content_type="application/xlsx"
"&amp;amp;path\CHECK_LIST_CONNECT_&amp;amp;the_month&amp;amp;format" content_type="application/xlsx") 
encoding='whebrew';

data _null_;
file TestR;
run;
%end;
%else %if "&amp;amp;the_run."="Dual" %then %do;
/*שליחת קבצים של הרצה חצי שנתית*/
filename TestR email to = ("jonathan.chen@poalim.co.il") 
SUBJECT=" %SYSFUNC(date(), YYMMdd10.)צ'ק ליסט חצי שנתי לתאריך "
type='text/html'
attach=("&amp;amp;path\SHOTEF_CONS_MNG_AREA_MNG_PRATIT_&amp;amp;the_month&amp;amp;format" content_type="application/xlsx") 
encoding='whebrew';

data _null_;
file TestR;
run;
%end;

%mend;
%emailm;&lt;/CODE&gt;&lt;/PRE&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;/**/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this is what I get in the log:&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;1 The SAS System 11:06 Sunday, January 6, 2019&lt;/P&gt;&lt;P&gt;1 ;*';*";*/;quit;run;&lt;BR /&gt;2 OPTIONS PAGENO=MIN;&lt;BR /&gt;3 %LET _CLIENTTASKLABEL='Program';&lt;BR /&gt;4 %LET _CLIENTPROCESSFLOWNAME='Email_Send';&lt;BR /&gt;5 %LET _CLIENTPROJECTPATH='\\nasdepartments\DHC\General\HQ\מטה\צוות אנליזה\מערכת בקרות והדרכות\אכיפה מנהלית-&lt;BR /&gt;5 ! CHECK_LIST\צ''ק ליסט 2019\צק ליסט_V17_1.egp';&lt;BR /&gt;6 %LET _CLIENTPROJECTNAME='צק ליסט_V17_1.egp';&lt;BR /&gt;7 %LET _SASPROGRAMFILE=;&lt;BR /&gt;8&lt;BR /&gt;9 ODS _ALL_ CLOSE;&lt;BR /&gt;10 OPTIONS DEV=ACTIVEX;&lt;BR /&gt;11 GOPTIONS XPIXELS=0 YPIXELS=0;&lt;BR /&gt;12 FILENAME EGSR TEMP;&lt;BR /&gt;13 ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR&lt;BR /&gt;14 STYLE=HtmlBlue&lt;BR /&gt;15 STYLESHEET=(URL="file:///C:/Program%20Files%20(x86)/SASHome/x86/SASEnterpriseGuide/7.1/Styles/HtmlBlue.css")&lt;BR /&gt;16 NOGTITLE&lt;BR /&gt;17 NOGFOOTNOTE&lt;BR /&gt;18 GPATH=&amp;amp;sasworklocation&lt;BR /&gt;19 ENCODING=UTF8&lt;BR /&gt;20 options(rolap="on")&lt;BR /&gt;21 ;&lt;BR /&gt;NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR&lt;BR /&gt;22&lt;BR /&gt;23 GOPTIONS ACCESSIBLE;&lt;BR /&gt;24&lt;BR /&gt;25&lt;BR /&gt;26 %macro emailm;&lt;BR /&gt;27 %if "&amp;amp;the_run."="hdq" %then %do;&lt;BR /&gt;28 filename TestR email to = ("jonathan.chen@poalim.co.il") /*כתובת מייל תפוצה ייעודית לתהליך*/&lt;BR /&gt;29 SUBJECT=" %SYSFUNC(date(), YYMMdd10.)צ'ק ליסט דו חודשי לתאריך "&lt;BR /&gt;30 type='text/html'&lt;BR /&gt;31 attach=("&amp;amp;path\SHOTEF_MNG_SNIF_MNG_PRATIT_&amp;amp;the_month&amp;amp;format" content_type="application/xlsx"&lt;BR /&gt;32 "&amp;amp;path\CHECK_LIST_CONNECT_&amp;amp;the_month&amp;amp;format" content_type="application/xlsx")&lt;BR /&gt;33 encoding='whebrew';&lt;BR /&gt;34&lt;BR /&gt;35 data _null_;&lt;BR /&gt;36 file TestR;&lt;BR /&gt;37 run;&lt;BR /&gt;38 %end;&lt;BR /&gt;39 %else %if "&amp;amp;the_run."="Quarterly" %then %do;&lt;BR /&gt;40 /*שליחת קבצים של הרצה רבעונית*/&lt;BR /&gt;41 filename TestR email to = ("jonathan.chen@poalim.co.il")&lt;BR /&gt;42 cc= ("jonathan.chen@poalim.co.il")/*כתובת מייל תפוצה ייעודית לתהליך*/&lt;BR /&gt;43 SUBJECT=" %SYSFUNC(date(), YYMMdd10.)צ'ק ליסט רבעוני לתאריך "&lt;BR /&gt;44 type='text/html'&lt;BR /&gt;45 attach=("&amp;amp;path\CHECK_LIST_PLAT_&amp;amp;the_month&amp;amp;format" content_type="application/xlsx"&lt;BR /&gt;46 "&amp;amp;path\CHECK_LIST_CONNECT_&amp;amp;the_month&amp;amp;format" content_type="application/xlsx")&lt;BR /&gt;47 encoding='whebrew';&lt;BR /&gt;48&lt;BR /&gt;49 data _null_;&lt;BR /&gt;50 file TestR;&lt;BR /&gt;51 run;&lt;BR /&gt;52 %end;&lt;BR /&gt;53 %else %if "&amp;amp;the_run."="Dual" %then %do;&lt;BR /&gt;54 /*שליחת קבצים של הרצה חצי שנתית*/&lt;BR /&gt;55 filename TestR email to = ("jonathan.chen@poalim.co.il") /*כתובת מייל תפוצה ייעודית לתהליך*/&lt;BR /&gt;56 SUBJECT=" %SYSFUNC(date(), YYMMdd10.)צ'ק ליסט חצי שנתי לתאריך "&lt;BR /&gt;2 The SAS System 11:06 Sunday, January 6, 2019&lt;/P&gt;&lt;P&gt;57 type='text/html'&lt;BR /&gt;58 attach=("&amp;amp;path\SHOTEF_CONS_MNG_AREA_MNG_PRATIT_&amp;amp;the_month&amp;amp;format" content_type="application/xlsx")&lt;BR /&gt;59 encoding='whebrew';&lt;BR /&gt;60&lt;BR /&gt;61 data _null_;&lt;BR /&gt;62 file TestR;&lt;BR /&gt;63 run;&lt;BR /&gt;64 %end;&lt;BR /&gt;65&lt;BR /&gt;66 %mend;&lt;BR /&gt;67 %emailm;&lt;BR /&gt;68&lt;BR /&gt;69 GOPTIONS NOACCESSIBLE;&lt;BR /&gt;70 %LET _CLIENTTASKLABEL=;&lt;BR /&gt;71 %LET _CLIENTPROCESSFLOWNAME=;&lt;BR /&gt;72 %LET _CLIENTPROJECTPATH=;&lt;BR /&gt;73 %LET _CLIENTPROJECTNAME=;&lt;BR /&gt;74 %LET _SASPROGRAMFILE=;&lt;BR /&gt;75&lt;BR /&gt;76 ;*';*";*/;quit;run;&lt;BR /&gt;77 ODS _ALL_ CLOSE;&lt;BR /&gt;78&lt;BR /&gt;79&lt;BR /&gt;80 QUIT; RUN;&lt;BR /&gt;81&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jan 2019 09:45:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas-using-macro-and-mulipe-if-statements/m-p/524875#M32781</guid>
      <dc:creator>Yonichen73</dc:creator>
      <dc:date>2019-01-06T09:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: sending emails from sas using macro and mulipe if statements</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas-using-macro-and-mulipe-if-statements/m-p/524877#M32782</link>
      <description>&lt;P&gt;Looks to me like none of your %if conditions is fulfilled. Inspect macro variable the_run.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jan 2019 10:44:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas-using-macro-and-mulipe-if-statements/m-p/524877#M32782</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-06T10:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: sending emails from sas using macro and mulipe if statements</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas-using-macro-and-mulipe-if-statements/m-p/524878#M32783</link>
      <description>&lt;P&gt;hi.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for the quick answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the_run macro gets:'hdq' because the month is 1 (January)&amp;nbsp; and I was checking that with %put &amp;amp;the_run.;&lt;BR /&gt;and then I got: hdq&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jan 2019 10:56:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas-using-macro-and-mulipe-if-statements/m-p/524878#M32783</guid>
      <dc:creator>Yonichen73</dc:creator>
      <dc:date>2019-01-06T10:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: sending emails from sas using macro and mulipe if statements</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas-using-macro-and-mulipe-if-statements/m-p/524884#M32784</link>
      <description>&lt;P&gt;Your log does not show the %put, so it might have run in a different context.&lt;/P&gt;
&lt;P&gt;Your data _null_ that sets the macro variable is faulty; see Maxim 47 (Quarterly will be shortened to Quar).&lt;/P&gt;
&lt;P&gt;Additionally, use call symputx (which removes trailing blanks from values), or omit the double quotes in the %if conditions. In macro language, "hdt" is different from "hdt ".&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jan 2019 12:02:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas-using-macro-and-mulipe-if-statements/m-p/524884#M32784</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-06T12:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: sending emails from sas using macro and mulipe if statements</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas-using-macro-and-mulipe-if-statements/m-p/524891#M32785</link>
      <description>&lt;P&gt;It works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you very much :]&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jan 2019 14:39:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas-using-macro-and-mulipe-if-statements/m-p/524891#M32785</guid>
      <dc:creator>Yonichen73</dc:creator>
      <dc:date>2019-01-06T14:39:11Z</dc:date>
    </item>
  </channel>
</rss>

