<?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: How to mask &amp;amp; in datastep in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-mask-amp-in-datastep/m-p/774077#M245966</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Macro variable &amp;amp;test2 would need to exist when using resolve(). If you just want to retrieve the value from &amp;amp;test then use symget() instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let test2=some value;
data test;
  call symputx('test','&amp;amp;test2');
  test=resolve('&amp;amp;test');
  test2=symget("test");
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1634170802557.png" style="width: 348px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64677i2150503DB6A2DD12/image-dimensions/348x134?v=v2" width="348" height="134" role="button" title="Patrick_0-1634170802557.png" alt="Patrick_0-1634170802557.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Oct 2021 00:20:28 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2021-10-14T00:20:28Z</dc:date>
    <item>
      <title>How to mask &amp; in datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-mask-amp-in-datastep/m-p/774074#M245964</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Given the program below how do I prevent the warnings?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test;&lt;BR /&gt;call symputx('test','&amp;amp;test2');&lt;BR /&gt;test=resolve('&amp;amp;test');&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 00:02:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-mask-amp-in-datastep/m-p/774074#M245964</guid>
      <dc:creator>gyambqt</dc:creator>
      <dc:date>2021-10-14T00:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to mask &amp; in datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-mask-amp-in-datastep/m-p/774075#M245965</link>
      <description>&lt;P&gt;Which warning?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macro variables do not resolve inside single quotes. If you have a macro variable named test2 and want the value treated as text you would use&amp;nbsp; "&amp;amp;test2"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may have to share exactly what you expect as it isn't obvious from either your question or code.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 00:16:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-mask-amp-in-datastep/m-p/774075#M245965</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-10-14T00:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to mask &amp; in datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-mask-amp-in-datastep/m-p/774077#M245966</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Macro variable &amp;amp;test2 would need to exist when using resolve(). If you just want to retrieve the value from &amp;amp;test then use symget() instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let test2=some value;
data test;
  call symputx('test','&amp;amp;test2');
  test=resolve('&amp;amp;test');
  test2=symget("test");
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1634170802557.png" style="width: 348px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64677i2150503DB6A2DD12/image-dimensions/348x134?v=v2" width="348" height="134" role="button" title="Patrick_0-1634170802557.png" alt="Patrick_0-1634170802557.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 00:20:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-mask-amp-in-datastep/m-p/774077#M245966</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-10-14T00:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to mask &amp; in datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-mask-amp-in-datastep/m-p/774078#M245967</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is your goal to make a macro variable TEST which has the value &amp;amp;test2, and then use the RESOLVE function to write that value to a data step variable TEST without treating the &amp;amp; in the value as a macro trigger?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so, then %superq can help:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;1    data test;
2    call symputx('test','&amp;amp;test2');
3    test=resolve('%superq(test)');
4    put test= ;
5    run;

test=&amp;amp;test2
NOTE: The data set WORK.TEST has 1 observations and 1 variables.
&lt;/PRE&gt;
&lt;P&gt;but unless this is an academic exercise, it might be worth describing more of the big picture behind your goal.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 00:33:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-mask-amp-in-datastep/m-p/774078#M245967</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2021-10-14T00:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to mask &amp; in datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-mask-amp-in-datastep/m-p/774094#M245975</link>
      <description>Can you pls explain why is it working?  I understand both %superq and resolve but what is happening when they used together?</description>
      <pubDate>Thu, 14 Oct 2021 02:05:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-mask-amp-in-datastep/m-p/774094#M245975</guid>
      <dc:creator>gyambqt</dc:creator>
      <dc:date>2021-10-14T02:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to mask &amp; in datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-mask-amp-in-datastep/m-p/774218#M246039</link>
      <description>&lt;P&gt;Without %superq, the resolve function resolves the macro variable reference &amp;amp;test, to the value &amp;amp;test2 and it sees that as a macro variable reference so tries to resolve the macro variable TEST2, which doesn't exist, so it throws the warning.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With %superq the resolve function&amp;nbsp;resolves the macro variable reference &amp;amp;test, to the value&amp;nbsp; [masked &amp;amp;]test2 which is not a macro variable reference so there is no attempt to resolve TEST2.&amp;nbsp; The job of %SUPERQ is to resolve a macro variable, and then mask any &amp;amp; or % in the resolved value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To be honest, I wasn't sure %SUPERQ would work here, because I don't use the RESOLVE function much.&amp;nbsp; But it looks to me like it is doing its usual job.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 13:43:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-mask-amp-in-datastep/m-p/774218#M246039</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2021-10-14T13:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to mask &amp; in datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-mask-amp-in-datastep/m-p/774236#M246051</link>
      <description>thanks</description>
      <pubDate>Thu, 14 Oct 2021 14:29:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-mask-amp-in-datastep/m-p/774236#M246051</guid>
      <dc:creator>gyambqt</dc:creator>
      <dc:date>2021-10-14T14:29:34Z</dc:date>
    </item>
  </channel>
</rss>

