<?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 macro quoting at macro parameter value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-quoting-at-macro-parameter-value/m-p/307286#M65784</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following program was taken from this paper where %NRBQUOTE (&lt;SPAN&gt;%NRQUOTE)&lt;/SPAN&gt;&amp;nbsp;is used to quote macro parameter value. (&lt;A href="http://www.lexjansen.com/phuse/2014/cc/CC02.pdf" target="_blank"&gt;http://www.lexjansen.com/phuse/2014/cc/CC02.pdf&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO Ex_3(Food);
	%IF (&amp;amp;Food EQ %NRSTR(Rice &amp;amp; Beans)) %THEN
		%PUT Try the House Special - &amp;amp;Food;
	%ELSE %PUT &amp;amp;Food - a tasty snack!;
%MEND Ex_3;

%Ex_3(%NRBQUOTE(Rice &amp;amp; Beans));&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When I use %NRSTR as macro quoting function for parameter value I get the same result. So in this situation both compile time and execution time macro quoting functions can be used?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO Ex_3(Food);
	%IF (&amp;amp;Food EQ %NRSTR(Rice &amp;amp; Beans)) %THEN
		%PUT Try the House Special - &amp;amp;Food;
	%ELSE %PUT &amp;amp;Food - a tasty snack!;
%MEND Ex_3;

%Ex_3(%NRSTR(Rice &amp;amp; Beans));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Oct 2016 02:33:20 GMT</pubDate>
    <dc:creator>SAS_inquisitive</dc:creator>
    <dc:date>2016-10-26T02:33:20Z</dc:date>
    <item>
      <title>macro quoting at macro parameter value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-quoting-at-macro-parameter-value/m-p/307286#M65784</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following program was taken from this paper where %NRBQUOTE (&lt;SPAN&gt;%NRQUOTE)&lt;/SPAN&gt;&amp;nbsp;is used to quote macro parameter value. (&lt;A href="http://www.lexjansen.com/phuse/2014/cc/CC02.pdf" target="_blank"&gt;http://www.lexjansen.com/phuse/2014/cc/CC02.pdf&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO Ex_3(Food);
	%IF (&amp;amp;Food EQ %NRSTR(Rice &amp;amp; Beans)) %THEN
		%PUT Try the House Special - &amp;amp;Food;
	%ELSE %PUT &amp;amp;Food - a tasty snack!;
%MEND Ex_3;

%Ex_3(%NRBQUOTE(Rice &amp;amp; Beans));&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When I use %NRSTR as macro quoting function for parameter value I get the same result. So in this situation both compile time and execution time macro quoting functions can be used?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO Ex_3(Food);
	%IF (&amp;amp;Food EQ %NRSTR(Rice &amp;amp; Beans)) %THEN
		%PUT Try the House Special - &amp;amp;Food;
	%ELSE %PUT &amp;amp;Food - a tasty snack!;
%MEND Ex_3;

%Ex_3(%NRSTR(Rice &amp;amp; Beans));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 02:33:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-quoting-at-macro-parameter-value/m-p/307286#M65784</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-10-26T02:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: macro quoting at macro parameter value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-quoting-at-macro-parameter-value/m-p/307299#M65791</link>
      <description>&lt;P&gt;Yes. %NRBQUOTE is usually for macro variable. Since you don't have any macro variable in parameter ,&lt;/P&gt;
&lt;P&gt;no macro variable would be explained in %NRBQUOTE . Both %NRBQUOTE and %NRSTR(is for text) would be accepted.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 03:35:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-quoting-at-macro-parameter-value/m-p/307299#M65791</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-10-26T03:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: macro quoting at macro parameter value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-quoting-at-macro-parameter-value/m-p/307305#M65795</link>
      <description>&lt;P&gt;You are quoting in the wrong place. You do not need to quote your example value in the macro call. &amp;nbsp;You need to quote the value in the implied %EVAL() function call that the %IF statement is generating.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO Ex_3(Food);
	%IF (%superq(food) EQ %NRSTR(Rice &amp;amp; Beans)) %THEN
		%PUT Try the House Special - &amp;amp;Food;
	%ELSE %PUT &amp;amp;Food - a tasty snack!;
%MEND Ex_3;

%Ex_3(Rice &amp;amp; Beans);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Oct 2016 04:07:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-quoting-at-macro-parameter-value/m-p/307305#M65795</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-10-26T04:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: macro quoting at macro parameter value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-quoting-at-macro-parameter-value/m-p/307328#M65800</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in your example there is no diiference in the result no matter you use %NRBQUOTE or %NRSTR.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But consider the following examples (where Rice&amp;amp;Beans are written without any space) and you may notice the difference between them.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO Ex_3(Food);
	%IF (&amp;amp;Food EQ %NRSTR(Rice&amp;amp;Beans)) %THEN
		%PUT Try the House Special - &amp;amp;Food;
	%ELSE %PUT &amp;amp;Food - a tasty snack!;
%MEND Ex_3;

/*macro variable &amp;amp;beans is not resolved therefore besides the put message
there is also an warning message in the log*/
%Ex_3(%NRBQUOTE(Rice&amp;amp;Beans));
/*macro variable &amp;amp;beans is maske therefore the put message written in the log*/
%Ex_3(%NRSTR(Rice&amp;amp;Beans));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 07:43:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-quoting-at-macro-parameter-value/m-p/307328#M65800</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2016-10-26T07:43:13Z</dc:date>
    </item>
  </channel>
</rss>

