<?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: Macro in Developers</title>
    <link>https://communities.sas.com/t5/Developers/Macro/m-p/2944#M1669</link>
    <description>Essentially, what you have to do is HIDE, PROTECT, or otherwise remove the normal meaning from the &amp;amp; -- the normal meaning of the &amp;amp; to SAS is as a macro trigger -- which sends your code with the &amp;amp; to the macro processor to resolve what SAS thinks is a symbolic reference to a macro variable. So when you submit:&lt;BR /&gt;
[pre]&lt;BR /&gt;
10   %let x = "a&amp;amp;b";&lt;BR /&gt;
WARNING: Apparent symbolic reference B not resolved.&lt;BR /&gt;
11   %put =====&amp;gt; x= &amp;amp;x;&lt;BR /&gt;
WARNING: Apparent symbolic reference B not resolved.&lt;BR /&gt;
=====&amp;gt; x= "a&amp;amp;b"&lt;BR /&gt;
[/pre]&lt;BR /&gt;
you get the log as shown above. The macro facility went to look up &amp;amp;b, didn't find it when handling the %let, so you get a warning message. Then, when you go to use &amp;amp;b again (as in the %PUT), you will get the warning again, because every reference causes an unsuccessful lookup to the memory table where macro variables are stored (Global Symbol Table).&lt;BR /&gt;
 &lt;BR /&gt;
What you do, depends on whether you need the quotes to be double quotes or not. One method of hiding the normal/macro meaning of an &amp;amp; is to enclose it in single quotes (SAS Log shown below):&lt;BR /&gt;
[pre]&lt;BR /&gt;
12&lt;BR /&gt;
13   %let xx = 'a&amp;amp;b';&lt;BR /&gt;
14   %put =====&amp;gt; xx= &amp;amp;xx;&lt;BR /&gt;
=====&amp;gt; xx= 'a&amp;amp;b'&lt;BR /&gt;
[/pre]&lt;BR /&gt;
  &lt;BR /&gt;
The other way of hiding or removing the normal meaning from &amp;amp; is to use the &lt;BR /&gt;
%nrstr function -- which also will prevent it from being resolved:&lt;BR /&gt;
[pre]&lt;BR /&gt;
16   %let xxx = %nrstr("a&amp;amp;b");&lt;BR /&gt;
17   %put =====&amp;gt; xxx= &amp;amp;xxx;&lt;BR /&gt;
=====&amp;gt; xxx= "a&amp;amp;b"&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
For more help with macro functions and usage, you should consult the SAS Macro facility documentation or contact SAS Technical Support for help with your SAS macro variable usage.&lt;BR /&gt;
 &lt;BR /&gt;
Good luck,&lt;BR /&gt;
cynthia</description>
    <pubDate>Sat, 28 Apr 2007 16:41:17 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2007-04-28T16:41:17Z</dc:date>
    <item>
      <title>Macro</title>
      <link>https://communities.sas.com/t5/Developers/Macro/m-p/2943#M1668</link>
      <description>This is probably the wrong category. But I'm running into SAS trouble with macros. I have text with an '&amp;amp;' that I want as text and not as a macro symbol. What should I do?&lt;BR /&gt;
&lt;BR /&gt;
For example:&lt;BR /&gt;
%let x="a&amp;amp;b";&lt;BR /&gt;
&lt;BR /&gt;
where &amp;amp; is not referring to &amp;amp;b.&lt;BR /&gt;
&lt;BR /&gt;
Any suggestions?</description>
      <pubDate>Fri, 27 Apr 2007 21:06:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Macro/m-p/2943#M1668</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-04-27T21:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/Developers/Macro/m-p/2944#M1669</link>
      <description>Essentially, what you have to do is HIDE, PROTECT, or otherwise remove the normal meaning from the &amp;amp; -- the normal meaning of the &amp;amp; to SAS is as a macro trigger -- which sends your code with the &amp;amp; to the macro processor to resolve what SAS thinks is a symbolic reference to a macro variable. So when you submit:&lt;BR /&gt;
[pre]&lt;BR /&gt;
10   %let x = "a&amp;amp;b";&lt;BR /&gt;
WARNING: Apparent symbolic reference B not resolved.&lt;BR /&gt;
11   %put =====&amp;gt; x= &amp;amp;x;&lt;BR /&gt;
WARNING: Apparent symbolic reference B not resolved.&lt;BR /&gt;
=====&amp;gt; x= "a&amp;amp;b"&lt;BR /&gt;
[/pre]&lt;BR /&gt;
you get the log as shown above. The macro facility went to look up &amp;amp;b, didn't find it when handling the %let, so you get a warning message. Then, when you go to use &amp;amp;b again (as in the %PUT), you will get the warning again, because every reference causes an unsuccessful lookup to the memory table where macro variables are stored (Global Symbol Table).&lt;BR /&gt;
 &lt;BR /&gt;
What you do, depends on whether you need the quotes to be double quotes or not. One method of hiding the normal/macro meaning of an &amp;amp; is to enclose it in single quotes (SAS Log shown below):&lt;BR /&gt;
[pre]&lt;BR /&gt;
12&lt;BR /&gt;
13   %let xx = 'a&amp;amp;b';&lt;BR /&gt;
14   %put =====&amp;gt; xx= &amp;amp;xx;&lt;BR /&gt;
=====&amp;gt; xx= 'a&amp;amp;b'&lt;BR /&gt;
[/pre]&lt;BR /&gt;
  &lt;BR /&gt;
The other way of hiding or removing the normal meaning from &amp;amp; is to use the &lt;BR /&gt;
%nrstr function -- which also will prevent it from being resolved:&lt;BR /&gt;
[pre]&lt;BR /&gt;
16   %let xxx = %nrstr("a&amp;amp;b");&lt;BR /&gt;
17   %put =====&amp;gt; xxx= &amp;amp;xxx;&lt;BR /&gt;
=====&amp;gt; xxx= "a&amp;amp;b"&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
For more help with macro functions and usage, you should consult the SAS Macro facility documentation or contact SAS Technical Support for help with your SAS macro variable usage.&lt;BR /&gt;
 &lt;BR /&gt;
Good luck,&lt;BR /&gt;
cynthia</description>
      <pubDate>Sat, 28 Apr 2007 16:41:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Macro/m-p/2944#M1669</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-04-28T16:41:17Z</dc:date>
    </item>
  </channel>
</rss>

