<?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: Need help to include macro variable values in email in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352079#M82033</link>
    <description>&lt;P&gt;Are you sure that &amp;amp;GETDATE never resolves - not even in the %PUT?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the X statement you have a mismatched single quote.&amp;nbsp; Also you cannot surround a macro reference with a single quote and still get resolution.&amp;nbsp; There are several ways to get around this, try this general form of the X statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x %tslit(echo "&amp;amp;getdate");&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 21 Apr 2017 07:45:22 GMT</pubDate>
    <dc:creator>ArtC</dc:creator>
    <dc:date>2017-04-21T07:45:22Z</dc:date>
    <item>
      <title>Need help to include macro variable values in email in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352073#M82031</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My exact task is, I have to show few data values which needs to take values from SAS tables using SAS&amp;nbsp;macro variables&amp;nbsp;and should show in&amp;nbsp;email body. And below is the email smaple body.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mail body required;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;FONT size="3"&gt;&lt;FONT face="Calibri"&gt;Report for&amp;nbsp;April 2017, the total sales amount is&amp;nbsp;&lt;STRONG&gt;90,500.50&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 8pt;"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;In these, Electronics amount is &lt;STRONG&gt;20,500 &lt;/STRONG&gt;and other business area amountsare&amp;nbsp;(&lt;STRONG&gt;50,300.50&lt;/STRONG&gt;), and&amp;nbsp;(&lt;STRONG&gt;20,000.10&lt;/STRONG&gt;).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;Caustion:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;All above information is strictly confidentail and not sharable.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;To do this, I just started below code and then&amp;nbsp;t&lt;/FONT&gt;rying to execute below code but macro variables are not resolved in email using X command. Please suggets me how can we achieve above task&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;x=today();&lt;/P&gt;&lt;P&gt;y=put(x,date9.);&lt;/P&gt;&lt;P&gt;put y;&lt;/P&gt;&lt;P&gt;call symput('getdate',y);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;%put &amp;amp;getdate;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;%sysexec export rundate=&amp;amp;getdate;&lt;/P&gt;&lt;P&gt;%sysexec echo $rundate;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;x 'echo "Run monthly job only on &amp;amp;getdate." | mailx -s "Mail Notification" banu.kumar@xxxxx.com;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 07:24:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352073#M82031</guid>
      <dc:creator>Banu</dc:creator>
      <dc:date>2017-04-21T07:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to include macro variable values in email in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352079#M82033</link>
      <description>&lt;P&gt;Are you sure that &amp;amp;GETDATE never resolves - not even in the %PUT?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the X statement you have a mismatched single quote.&amp;nbsp; Also you cannot surround a macro reference with a single quote and still get resolution.&amp;nbsp; There are several ways to get around this, try this general form of the X statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x %tslit(echo "&amp;amp;getdate");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Apr 2017 07:45:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352079#M82033</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2017-04-21T07:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to include macro variable values in email in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352102#M82042</link>
      <description>&lt;PRE&gt;%sysexec export rundate=&amp;amp;getdate;
%sysexec echo $rundate;&lt;/PRE&gt;
&lt;P&gt;Both of these commands start a shell; since the change in the environment (new environment variable rundate) is lost when the first shell terminates, the second command won't find $rundate.&lt;/P&gt;
&lt;P&gt;Only certain UNIX commands (cd, pwd, setenv, umask) are executed so that they have effect in the context of the SAS session itself.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 10:44:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352102#M82042</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-04-21T10:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to include macro variable values in email in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352108#M82043</link>
      <description>&lt;P&gt;Thanks for your sugegstion. It's helpful for me.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 10:53:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352108#M82043</guid>
      <dc:creator>Banu</dc:creator>
      <dc:date>2017-04-21T10:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to include macro variable values in email in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352110#M82044</link>
      <description>&lt;P&gt;It's working fine. Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 10:55:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352110#M82044</guid>
      <dc:creator>Banu</dc:creator>
      <dc:date>2017-04-21T10:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to include macro variable values in email in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352114#M82045</link>
      <description>&lt;P&gt;Is there any option to bold values in echo command in&lt;STRONG&gt; SAS X statement&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x %tslit(echo "Total&amp;nbsp;sales amount is: $500,200.10");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OUTPUT require as: Total&amp;nbsp;sales amount is: &lt;STRONG&gt;$500,200.10&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please suggest me.&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>Fri, 21 Apr 2017 11:08:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352114#M82045</guid>
      <dc:creator>Banu</dc:creator>
      <dc:date>2017-04-21T11:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to include macro variable values in email in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352127#M82047</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134610"&gt;@Banu&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Is there any option to bold values in echo command in&lt;STRONG&gt; SAS X statement&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;x %tslit(echo "Total&amp;nbsp;sales amount is: $500,200.10");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OUTPUT require as: Total&amp;nbsp;sales amount is: &lt;STRONG&gt;$500,200.10&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please suggest me.&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;No. echo is a UNIX commandline command that can only handle pure text, without any formatting. Also keep in mind that a data step used to create a mail message (using filename email) can only handle text.&lt;/P&gt;
&lt;P&gt;But you can use that data step to write HTML code into the mail, which allows you to use HTML formatting tags. An example for this can be found in &lt;A href="http://support.sas.com/resources/papers/proceedings10/060-2010.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings10/060-2010.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 11:44:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352127#M82047</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-04-21T11:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to include macro variable values in email in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352146#M82051</link>
      <description>&lt;P&gt;I have tried same as you mentioned, but getting "&lt;STRONG&gt;ERROR: Email: The connection was refused."&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I have given options like emailhost and emailsys. Any suggestions on this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 12:48:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352146#M82051</guid>
      <dc:creator>Banu</dc:creator>
      <dc:date>2017-04-21T12:48:36Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to include macro variable values in email in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352149#M82053</link>
      <description>&lt;P&gt;So your first task should be to make a very simple, "hello world" type mail work with filename email.&lt;/P&gt;
&lt;P&gt;"Connection refused" might indicate that&lt;/P&gt;
&lt;P&gt;- there is no SMTP server active on the host you named&lt;/P&gt;
&lt;P&gt;- it requires credentials&lt;/P&gt;
&lt;P&gt;- it only accepts connections from certain clients&lt;/P&gt;
&lt;P&gt;Check with your mail administrator how to access the SMTP server.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 12:54:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-include-macro-variable-values-in-email-in-SAS/m-p/352149#M82053</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-04-21T12:54:22Z</dc:date>
    </item>
  </channel>
</rss>

