<?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: Conditional sending of email via sas in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Conditional-sending-of-email-via-sas/m-p/584151#M14128</link>
    <description>&lt;P&gt;You can something like below, consider that the code is within the macro sample, this is an untested code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro sample;

%global variable1;

%let variable1=go;

%if &amp;amp;variable1=go %then %do;
filename mail email to='xxxxx@xxxx.com';
data _null_;
file mail;
put 'Hi';
run;
%end;

%mend sample;

%sample&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 27 Aug 2019 09:51:15 GMT</pubDate>
    <dc:creator>Jagadishkatam</dc:creator>
    <dc:date>2019-08-27T09:51:15Z</dc:date>
    <item>
      <title>Conditional sending of email via sas</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conditional-sending-of-email-via-sas/m-p/584150#M14127</link>
      <description>&lt;P&gt;Hi, I would like to ask you how to conditionally send an email from sas ?&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;%let variable1 ='go';

&amp;nbsp;if variable1 = 'go' then do;


FILENAME mail
EMAIL TO=(&amp;amp;emails)
etc ....
end;&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>Tue, 27 Aug 2019 09:46:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conditional-sending-of-email-via-sas/m-p/584150#M14127</guid>
      <dc:creator>SIgnificatif</dc:creator>
      <dc:date>2019-08-27T09:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sending of email via sas</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conditional-sending-of-email-via-sas/m-p/584151#M14128</link>
      <description>&lt;P&gt;You can something like below, consider that the code is within the macro sample, this is an untested code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro sample;

%global variable1;

%let variable1=go;

%if &amp;amp;variable1=go %then %do;
filename mail email to='xxxxx@xxxx.com';
data _null_;
file mail;
put 'Hi';
run;
%end;

%mend sample;

%sample&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Aug 2019 09:51:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conditional-sending-of-email-via-sas/m-p/584151#M14128</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-08-27T09:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sending of email via sas</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conditional-sending-of-email-via-sas/m-p/584172#M14135</link>
      <description>&lt;P&gt;Starting with SAS 9.4M5 (I think), %if can be used in open code (no macro definition necessary):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let variable1=go;

%if &amp;amp;variable1=go %then %do;


FILENAME mail
EMAIL TO=(&amp;amp;emails)
etc ....

%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that macro variables very rarely need quotes, quote are usually unnecessary and cause problems.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2019 11:20:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conditional-sending-of-email-via-sas/m-p/584172#M14135</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-08-27T11:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sending of email via sas</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conditional-sending-of-email-via-sas/m-p/584247#M14157</link>
      <description>&lt;P&gt;Is VARIABLE a macro variable, as it it appears in your first statement, or an actual variable in a SAS dataset, as it appears in your second statement?&amp;nbsp; If the later does the data have just one observation? If not what if some of the observations have values of go and other observations have values that are something else? Do you still want to send the email?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2019 14:20:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conditional-sending-of-email-via-sas/m-p/584247#M14157</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-27T14:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sending of email via sas</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conditional-sending-of-email-via-sas/m-p/584249#M14158</link>
      <description>it's a macro variable&lt;BR /&gt;1 I need to use a condition to check the value ,&lt;BR /&gt;2 else send another email. ( i found that there is no possibility to do an elseif if in macro variable mode) , limiting this to only 2 conditions...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Aug 2019 14:23:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conditional-sending-of-email-via-sas/m-p/584249#M14158</guid>
      <dc:creator>SIgnificatif</dc:creator>
      <dc:date>2019-08-27T14:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sending of email via sas</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conditional-sending-of-email-via-sas/m-p/584256#M14160</link>
      <description>&lt;P&gt;Not sure what an elseif is, but there is definitely a macro %ELSE statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if &amp;amp;variable=go %then %do;
....
%end;
%else %if &amp;amp;variable=stop %then %do;
....
%end;
%else&amp;nbsp;%do;
....
%end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Aug 2019 14:37:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conditional-sending-of-email-via-sas/m-p/584256#M14160</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-27T14:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sending of email via sas</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conditional-sending-of-email-via-sas/m-p/584458#M14176</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/250627"&gt;@SIgnificatif&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;it's a macro variable&lt;BR /&gt;1 I need to use a condition to check the value ,&lt;BR /&gt;2 else send another email. ( i found that there is no possibility to do an elseif if in macro variable mode) , limiting this to only 2 conditions...&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can use %else %if, as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;already showed, but this needs a macro definition. To implement the same logic in open code, you need to code the else-path with a separate %if:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if &amp;amp;variable1 = go
%then %do;

%end;
%if &amp;amp;variable1 ne go
%then %do;

%end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Aug 2019 08:01:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conditional-sending-of-email-via-sas/m-p/584458#M14176</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-08-28T08:01:35Z</dc:date>
    </item>
  </channel>
</rss>

