<?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: When do we need to quote &amp;quot;+&amp;quot; in SAS macro programming? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/When-do-we-need-to-quote-quot-quot-in-SAS-macro-programming/m-p/726714#M225855</link>
    <description>&lt;P&gt;Usually you use the + (plus) sign in mathematical operation,&lt;/P&gt;
&lt;P&gt;but sometimes you want to display a formula (to a child) and prompt for a result to check.&lt;/P&gt;
&lt;P&gt;Look at next code :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
    no_1 = '2';
    no_2 = '3';
    formula = no_1 || "+" || no_2 || "=?";
    put formula " Enter your answer";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The usage of macro programing is just a tool to generate a code which is finally sas code.&lt;/P&gt;</description>
    <pubDate>Tue, 16 Mar 2021 12:04:55 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2021-03-16T12:04:55Z</dc:date>
    <item>
      <title>When do we need to quote "+" in SAS macro programming?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-do-we-need-to-quote-quot-quot-in-SAS-macro-programming/m-p/726612#M225800</link>
      <description>&lt;P&gt;I am wondering does there exist a scenario that the "+" operator must be masked by quoting functions such as %STR or %BQUOTE? In SAS documentation, it states that "+" may need to be masked "&lt;SPAN&gt;&lt;EM&gt;To prevent it from being treated as an operator in the argument of an %EVAL function&lt;/EM&gt;".&amp;nbsp; However, I tested a couple of toy examples and found that directly typing "+" and using "%str(+)" makes no difference.&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, both "%let var1 = A+B;"&amp;nbsp; and "%let var2 = %str(A+B)"&amp;nbsp; resolve to "A+B" when &amp;amp;var1/&amp;amp;var2 is referenced -- there are no error/warning messages in the log. Therefore, it seems that SAS never misinterprets "+".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So my question is, could anyone construct a specific example that enclosing the "+" (or similar operators such as "=, -, *") with quoting function is a must? That is, without quoting it, the SAS will issue an error? Thank you very much!&lt;/P&gt;</description>
      <pubDate>Tue, 16 Mar 2021 03:24:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-do-we-need-to-quote-quot-quot-in-SAS-macro-programming/m-p/726612#M225800</guid>
      <dc:creator>Zhanxiong</dc:creator>
      <dc:date>2021-03-16T03:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: When do we need to quote "+" in SAS macro programming?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-do-we-need-to-quote-quot-quot-in-SAS-macro-programming/m-p/726623#M225806</link>
      <description>&lt;P&gt;The help page mentions function %eval, yet you haven't used it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%put %eval( 2 %str(+) 3 );&amp;nbsp; &amp;nbsp; will show you the effect of masking the +.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unsure why you'd ever want to do this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Mar 2021 05:35:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-do-we-need-to-quote-quot-quot-in-SAS-macro-programming/m-p/726623#M225806</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-03-16T05:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: When do we need to quote "+" in SAS macro programming?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-do-we-need-to-quote-quot-quot-in-SAS-macro-programming/m-p/726626#M225808</link>
      <description>&lt;P&gt;An %IF %THEN statement invokes %EVAL.&amp;nbsp; So try this combination:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let breakfast = ham + eggs;
%if &amp;amp;breakfast = ham + eggs %then %let fed=yes;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The first statement works just fine.&amp;nbsp; But the second statement generates an error message.&amp;nbsp; The implied %EVAL sees the plus sign, and tries to add together ham + eggs.&amp;nbsp; There are a few ways to get around this, and a quoting function is one of them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Mar 2021 06:00:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-do-we-need-to-quote-quot-quot-in-SAS-macro-programming/m-p/726626#M225808</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-03-16T06:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: When do we need to quote "+" in SAS macro programming?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-do-we-need-to-quote-quot-quot-in-SAS-macro-programming/m-p/726714#M225855</link>
      <description>&lt;P&gt;Usually you use the + (plus) sign in mathematical operation,&lt;/P&gt;
&lt;P&gt;but sometimes you want to display a formula (to a child) and prompt for a result to check.&lt;/P&gt;
&lt;P&gt;Look at next code :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
    no_1 = '2';
    no_2 = '3';
    formula = no_1 || "+" || no_2 || "=?";
    put formula " Enter your answer";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The usage of macro programing is just a tool to generate a code which is finally sas code.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Mar 2021 12:04:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-do-we-need-to-quote-quot-quot-in-SAS-macro-programming/m-p/726714#M225855</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-03-16T12:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: When do we need to quote "+" in SAS macro programming?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-do-we-need-to-quote-quot-quot-in-SAS-macro-programming/m-p/726737#M225870</link>
      <description>&lt;P&gt;%put %eval(2 %str(+) 3); will issue an error message, and I know that...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am asking to construct an example that only after %str(+) is added, the error/warning caused by directly using unmasked "+" can be AVOIDED, not the opposite direction.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Mar 2021 13:17:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-do-we-need-to-quote-quot-quot-in-SAS-macro-programming/m-p/726737#M225870</guid>
      <dc:creator>Zhanxiong</dc:creator>
      <dc:date>2021-03-16T13:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: When do we need to quote "+" in SAS macro programming?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-do-we-need-to-quote-quot-quot-in-SAS-macro-programming/m-p/726742#M225872</link>
      <description>This is exactly what I want. Thank you!</description>
      <pubDate>Tue, 16 Mar 2021 13:22:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-do-we-need-to-quote-quot-quot-in-SAS-macro-programming/m-p/726742#M225872</guid>
      <dc:creator>Zhanxiong</dc:creator>
      <dc:date>2021-03-16T13:22:04Z</dc:date>
    </item>
  </channel>
</rss>

