<?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: Can't use a macro variable without getting &amp;quot;Apparent symbolic reference B not resolved&amp;amp; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479354#M123712</link>
    <description>&lt;P&gt;Good ideas but it's probably html that will be passed on in many cases.&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jul 2018 02:33:05 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2018-07-19T02:33:05Z</dc:date>
    <item>
      <title>Can't use a macro variable without getting "Apparent symbolic reference B not resolved"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479315#M123690</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I need to dump a macro variable as is in a put statement. I can't find a way to do this cleanly.&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;%macro test(msg);
  data _null_; putlog '1 ' &amp;amp;msg. ;                 run;
  data _null_; putlog '2 ' %unquote(%superq(msg)); run;
  data _null_; putlog '3 ' %superq(msg) ;          run;
%mend;

%test( "a%str(&amp;amp;)b" / "bbb" );
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The first two data steps generate&amp;nbsp;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;WARNING: Apparent symbolic reference B not resolved.&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The third one fails to recognize the macro variable as valid sas code.&lt;/P&gt;
&lt;P&gt;Any idea?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 01:44:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479315#M123690</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-07-19T01:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use a macro variable without getting "Apparent symbolic reference B not resolved&amp;quot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479328#M123699</link>
      <description>&lt;P&gt;Your code is referencing some undefined macro variable A instead of the using MSG, the actual name of the parameter of the macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it really depends on WHAT you are expecting to print. If you want to print the actual value of the macro variable without the macro processor evaluating it then pull it into a character variable using the SYMGET() function. If you want the data step to interpret the value as two strings separated by the / new line command for a PUT statement then use single quotes to prevent the macro processor from evaluating the strings.&lt;/P&gt;
&lt;PRE&gt;647  %macro test(msg);
648    data _null_; putlog '1 ' &amp;amp;msg ;                 run;
649    data _null_; length msg $200; msg=symget('msg'); put '4 ' msg ; run;
650  %mend;
651
652  options mprint;
653  %test( 'a&amp;amp;b' / "bbb" );
MPRINT(TEST):   data _null_;
MPRINT(TEST):   putlog '1 ' 'a&amp;amp;b' / "bbb" ;
MPRINT(TEST):   run;

1 a&amp;amp;b
bbb
NOTE: DATA statement used (Total process time):
      real time           0.16 seconds
      cpu time            0.00 seconds


MPRINT(TEST):   data _null_;
MPRINT(TEST):   length msg $200;
MPRINT(TEST):   msg=symget('msg');
MPRINT(TEST):   put '4 ' msg ;
MPRINT(TEST):   run;

4 'a&amp;amp;b' / "bbb"
NOTE: DATA statement used (Total process time):
      real time           0.14 seconds
      cpu time            0.00 seconds&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 00:44:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479328#M123699</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-07-19T00:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use a macro variable without getting "Apparent symbolic reference B not resolved&amp;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479345#M123707</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Your code is referencing some undefined macro variable A&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Fixed, sorry about that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have no control over what values are sent.&lt;/P&gt;
&lt;P&gt;Thinking about it over lunch, this was a silly question.&lt;/P&gt;
&lt;P&gt;If the parameter value creates code that&amp;nbsp;generates messages, there is nothing I can do about it. I just have to execute the code with whatever is sent. Running the put statement is the purpose here, so I must run it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The text is going to an email message.&lt;/P&gt;
&lt;P&gt;The only way I could avoid it is if there&amp;nbsp;existed an&lt;FONT face="courier new,courier"&gt; !EM_MESSAGE!&lt;/FONT&gt; directive, such as as:&lt;/P&gt;
&lt;PRE&gt;&amp;nbsp;put '!EM_MESSAGE!&amp;nbsp;  "a%str(&amp;amp;)b" / "bbb"  ';&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 02:08:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479345#M123707</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-07-19T02:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use a macro variable without getting "Apparent symbolic reference B not resolved&amp;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479346#M123708</link>
      <description>&lt;P&gt;Train your users on how to pass in the messages so that they don't generate errors.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 02:10:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479346#M123708</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-07-19T02:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use a macro variable without getting "Apparent symbolic reference B not resolved&amp;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479347#M123709</link>
      <description>&lt;P&gt;True. That's always the last resort though.. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 02:11:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479347#M123709</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-07-19T02:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use a macro variable without getting "Apparent symbolic reference B not resolved&amp;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479348#M123710</link>
      <description>&lt;P&gt;This %SQUOTE() macro can help.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/sasutils/macros/blob/master/squote.sas" target="_self"&gt;%squote()&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 02:14:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479348#M123710</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-07-19T02:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use a macro variable without getting "Apparent symbolic reference B not resolved&amp;quot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479349#M123711</link>
      <description>&lt;P&gt;You could make your messaging macro smarter so that users are not passing in code, but data.&lt;/P&gt;
&lt;P&gt;Perhaps something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%putmsg(msg1,msg2,msg3,msg4,msg5);
length msg $200;
do i=1 to 5 ;
  msg=symget(cats('msg',i));
  if msg ne ' ' then put msg ;
end;
%mend;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Jul 2018 02:19:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479349#M123711</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-07-19T02:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use a macro variable without getting "Apparent symbolic reference B not resolved&amp;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479354#M123712</link>
      <description>&lt;P&gt;Good ideas but it's probably html that will be passed on in many cases.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 02:33:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479354#M123712</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-07-19T02:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use a macro variable without getting "Apparent symbolic reference B not resolved&amp;quot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479360#M123715</link>
      <description>&lt;P&gt;Idea &lt;A href="https://communities.sas.com/t5/SASware-Ballot-Ideas/Create-an-EM-MESSAGE-email-directive/idi-p/479358#M3328" target="_self"&gt;submitted&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 02:45:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-use-a-macro-variable-without-getting-quot-Apparent/m-p/479360#M123715</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-07-19T02:45:09Z</dc:date>
    </item>
  </channel>
</rss>

