<?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: SASPy and the Macro Processor in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912525#M359720</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/461640"&gt;@mrmcdonald&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What happens if you use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put %superq(&amp;amp;PRODUCT._ATTRIBUTE_SPEC_LIMIT);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;OR&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put _user_;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 22 Jan 2024 18:58:53 GMT</pubDate>
    <dc:creator>AhmedAl_Attar</dc:creator>
    <dc:date>2024-01-22T18:58:53Z</dc:date>
    <item>
      <title>SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912509#M359711</link>
      <description>&lt;P&gt;Hi Experts, I've been working to modernize our front-end applications using Python (with the PyQt framework) and connecting it to our existing back-end SAS programs. Typically, I've been successful in calling the back-end SAS programs by using %INCLUDE inside the submit() saspy method. Our back-end SAS programs utilize the macro language pretty extensively.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, the back-end programs use macro variable calls like &amp;amp;&amp;amp;&amp;amp;PRODUCT._ATTRIBUTE_SPEC_LIMIT which first resolves to &amp;amp;PROD1_ATTRIBUTE_SPEC_LIMIT which then resolves to a value like 95. In SAS, I can run the following code where both macro calls resolve to 95:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%LET PRODUCT = PROD1;
%LET PROD1_ATTRIBUTE_SPEC_LIMIT = 95;

%PUT Triple Ampersand result is &amp;amp;&amp;amp;&amp;amp;PRODUCT._ATTRIBUTE_SPEC_LIMIT;
%PUT Single Ampersand result is &amp;amp;PROD1_ATTRIBUTE_SPEC_LIMIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, in Python using the SASPy module, it appears only 1 "loop" is being run in the macro processor (instead of resolving until there's no &amp;amp;). Thus,&amp;nbsp;&amp;amp;&amp;amp;&amp;amp;PRODUCT._ATTRIBUTE_SPEC_LIMIT is only being resolved once to&amp;nbsp;&amp;amp;PROD1_ATTRIBUTE_SPEC_LIMIT and not 95. The following code could be pasted in Python provided the sas session object named "sas" has already been created:&lt;/P&gt;&lt;PRE&gt;import saspy

sas.symput("PRODUCT", "PROD1")
sas.symput("PROD1_ATTRIBUTE_SPEC_LIMIT", "95")
sas.submit_return_value = sas.submit(
    """
    %PUT Triple Ampersand result is &amp;amp;&amp;amp;&amp;amp;PRODUCT._ATTRIBUTE_SPEC_LIMIT;
    %PUT Single Ampersand result is &amp;amp;PROD1_ATTRIBUTE_SPEC_LIMIT;
    """,
results = 'LIST',
log = 'LIST'
)
print(sas_submit_return_value['LOG'])&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there something I may be missing? I would like to avoid touching the numerous back-end SAS programs if at all possible. Thanks for the help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 17:57:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912509#M359711</guid>
      <dc:creator>mrmcdonald</dc:creator>
      <dc:date>2024-01-22T17:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912513#M359712</link>
      <description>&lt;P&gt;The indirect references (i.e. the &amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp; type of references) in general can be fun to debug.&lt;/P&gt;
&lt;P&gt;Just of giggles have you tried 4 &amp;amp; version?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 18:08:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912513#M359712</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-01-22T18:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912519#M359714</link>
      <description>Not quite, what do you mean? I'm using versions SAS 9.4M3, Python 3.11, and SASPy 5.4.0. I've used MLOGIC, SYMBOLGEN, and MPRINT. Using SAS "directly", the macros are resolving but not when we use SASPy.</description>
      <pubDate>Mon, 22 Jan 2024 18:21:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912519#M359714</guid>
      <dc:creator>mrmcdonald</dc:creator>
      <dc:date>2024-01-22T18:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912525#M359720</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/461640"&gt;@mrmcdonald&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What happens if you use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put %superq(&amp;amp;PRODUCT._ATTRIBUTE_SPEC_LIMIT);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;OR&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put _user_;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Jan 2024 18:58:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912525#M359720</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2024-01-22T18:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912530#M359721</link>
      <description>&lt;P&gt;I don't think you're missing anything, and would suggest contacting tech support.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I'm curious, if you turn on system option SYMBOLGEN, does that provide any interesting information in the log about attempts to resolve macro variables?&amp;nbsp; I don't use saspy, but your SAS code shows a clear resolution process, consistent with your explanation of how it should work:&lt;/P&gt;
&lt;PRE&gt;1    options symbolgen ;
2    %LET PRODUCT = PROD1;
3    %LET PROD1_ATTRIBUTE_SPEC_LIMIT = 95;
4
5    %PUT Triple Ampersand result is &amp;amp;&amp;amp;&amp;amp;PRODUCT._ATTRIBUTE_SPEC_LIMIT;
SYMBOLGEN:  &amp;amp;&amp;amp; resolves to &amp;amp;.
SYMBOLGEN:  Macro variable PRODUCT resolves to PROD1
SYMBOLGEN:  Macro variable PROD1_ATTRIBUTE_SPEC_LIMIT resolves to 95
Triple Ampersand result is 95
6    %PUT Single Ampersand result is &amp;amp;PROD1_ATTRIBUTE_SPEC_LIMIT;
SYMBOLGEN:  Macro variable PROD1_ATTRIBUTE_SPEC_LIMIT resolves to 95
Single Ampersand result is 95
&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Jan 2024 19:20:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912530#M359721</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-01-22T19:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912535#M359724</link>
      <description>Thanks for the reply! My log (using SASPy) displays the following:&lt;BR /&gt;OPTIONS SYMBOLGEN;&lt;BR /&gt;&lt;BR /&gt;SYMBOLGEN: &amp;amp;&amp;amp; resolves to &amp;amp;.&lt;BR /&gt;SYMBOLGEN: Macro variable PRODUCT resolves to PROD1&lt;BR /&gt;SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;BR /&gt;%PUT Triple Ampersand result is &amp;amp;&amp;amp;&amp;amp;PRODUCT._ATTRIBUTE_SPEC_LIMIT;&lt;BR /&gt;Triple Ampersand result is &amp;amp;PROD1_ATTRIBUTE_SPEC_LIMIT</description>
      <pubDate>Mon, 22 Jan 2024 19:34:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912535#M359724</guid>
      <dc:creator>mrmcdonald</dc:creator>
      <dc:date>2024-01-22T19:34:04Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912539#M359726</link>
      <description>I get an error message when I try a single &amp;amp;.&lt;BR /&gt;SYMBOLGEN: Macro variable PRODUCT resolves to PROD1&lt;BR /&gt;SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;BR /&gt;ERROR: Invalid symbolic variable name PROD1.</description>
      <pubDate>Mon, 22 Jan 2024 19:37:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912539#M359726</guid>
      <dc:creator>mrmcdonald</dc:creator>
      <dc:date>2024-01-22T19:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912541#M359728</link>
      <description>&lt;P&gt;I'd say that log fits with your thought that &amp;amp;&amp;amp; isn't actually triggering a re-scan like it should.&amp;nbsp; I would send the code with the SYMBOLGEN option and the log to tech support, and see what they have to say.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 19:38:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912541#M359728</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-01-22T19:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912542#M359729</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/461640"&gt;@mrmcdonald&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I get an error message when I try a single &amp;amp;.&lt;BR /&gt;SYMBOLGEN: Macro variable PRODUCT resolves to PROD1&lt;BR /&gt;SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;BR /&gt;ERROR: Invalid symbolic variable name PROD1.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That log makes no sense to me at all.&amp;nbsp; It's as if a single ampersand is somehow triggering a rescan.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 19:40:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912542#M359729</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-01-22T19:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912564#M359735</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/461640"&gt;@mrmcdonald&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is what I was able to get from my SASPy session&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;gt;&amp;gt;&amp;gt; sas=saspy.SASsession(cfgname='ssh')
Pandas module not available. Setting results to HTML
*** bcc-inf-idns01.tco.census.gov can't find 20HQPLSU4464016: Non-existent domain
SAS Connection established. Subprocess id is 8968

&amp;gt;&amp;gt;&amp;gt; sas.symput('PRODUCT','PROD1')
&amp;gt;&amp;gt;&amp;gt; sas.symput('PROD1_ATTRIBUTE_SPEC_LIMIT','95')
&amp;gt;&amp;gt;&amp;gt; ll = sas.submit('%put _user_')
&amp;gt;&amp;gt;&amp;gt; print(ll['LOG'])

31   ods listing close;ods html5 (id=saspy_internal) file=stdout options(bitmap_mode='inline') device=svg style=HTMLBlue; ods
31 ! graphics on / outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: STDOUT
32
33   %put _user_
34
35   ods html5 (id=saspy_internal) close;ods listing;
GLOBAL PROD1_ATTRIBUTE_SPEC_LIMIT &amp;#6;95
GLOBAL PRODUCT &amp;#6;PROD1&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; py_val = sas.symget('PROD1'+'_ATTRIBUTE_SPEC_LIMIT')&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; py_val&lt;BR /&gt;95
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt; I'm running Python 3.9.6 (on my laptop) and SAS 9.4 M8 (on my Linux Server)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The %put _user_ is just to ensure the macro variables were correctly defined in SAS&lt;/P&gt;
&lt;P&gt;The sas.symget clause to illustrate how to use Python string literal with SAS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm aware this does not resolve your macro resolution issue, but you may want to rethink the way to go about it!?&amp;nbsp;Here is a link to samples on how to use symput &amp;amp; symget with SASPy&lt;/P&gt;
&lt;P&gt;&lt;A title="Using_SYMGET_and_SYMPUT.ipynb" href="https://github.com/sassoftware/saspy-examples/blob/main/SAS_contrib/Using_SYMGET_and_SYMPUT.ipynb" target="_blank" rel="noopener"&gt;Using_SYMGET_and_SYMPUT.ipynb&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Ahmed&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 21:35:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912564#M359735</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2024-01-22T21:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912567#M359737</link>
      <description>&lt;P&gt;What does the LOG returned by sas.submit() show you?&lt;BR /&gt;Why are you passing 'LIST' as the value for both RESULTS and LOGS option?&amp;nbsp; Is that is just saying "YES I want those to be returned"? Or is the name you want it to assign to them?&amp;nbsp; If the latter is it an issue if you use the same name for both?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another debugging test is to make sure the macro variables really exist.&amp;nbsp; Try using a data step instead of macro code to display the values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  product = symget('product');
  limit = symget(cats(product,'_attribute_spec_limit'));
  put product= / limit=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Jan 2024 21:54:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/912567#M359737</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-01-22T21:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/914281#M360257</link>
      <description>&lt;P&gt;I think that all you need to do to get the triple ampers to resolve as you're expecting is to specify quoting=None on the first symput call. The default is to use NRBQUOTE when defining the macro variable, which is 'usually' the most helpful, but with SAS/Marco there's always any number of weird things you need to deal with. See the doc for symput() here:&amp;nbsp;&lt;A href="https://sassoftware.github.io/saspy/api.html#saspy.SASsession.symput" target="_blank"&gt;https://sassoftware.github.io/saspy/api.html#saspy.SASsession.symput&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's what I see with and without that:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; sas.symput("PRODUCT1", "PROD1");print(sas.lastlog())&lt;/P&gt;
&lt;P&gt;21&lt;BR /&gt;22 %let PRODUCT1=%NRBQUOTE(PROD1);&lt;BR /&gt;23&lt;BR /&gt;24&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; sas.symput("PROD1_ATTRIBUTE_SPEC_LIMIT", "96");print(sas.lastlog())&lt;/P&gt;
&lt;P&gt;26&lt;BR /&gt;27 %let PROD1_ATTRIBUTE_SPEC_LIMIT=%NRBQUOTE(96);&lt;BR /&gt;28&lt;BR /&gt;29&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; sas.submitLOG('''&lt;BR /&gt;... %PUT Triple Ampersand result is &amp;amp;&amp;amp;&amp;amp;PRODUCT1._ATTRIBUTE_SPEC_LIMIT;&lt;BR /&gt;... %PUT Single Ampersand result is &amp;amp;PROD1_ATTRIBUTE_SPEC_LIMIT;&lt;BR /&gt;... ''')&lt;/P&gt;
&lt;P&gt;31 ods listing close;ods html5 (id=saspy_internal) file=stdout options(bitmap_mode='inline') device=svg style=HTMLBlue; ods&lt;BR /&gt;31 ! graphics on / outputfmt=png;&lt;BR /&gt;NOTE: Writing HTML5(SASPY_INTERNAL) Body file: STDOUT&lt;BR /&gt;32&lt;BR /&gt;33&lt;BR /&gt;34 %PUT Triple Ampersand result is &amp;amp;&amp;amp;&amp;amp;PRODUCT1._ATTRIBUTE_SPEC_LIMIT;&lt;BR /&gt;Triple Ampersand result is &amp;amp;PROD1_ATTRIBUTE_SPEC_LIMIT&lt;BR /&gt;35 %PUT Single Ampersand result is &amp;amp;PROD1_ATTRIBUTE_SPEC_LIMIT;&lt;BR /&gt;Single Ampersand result is 96&lt;BR /&gt;36&lt;BR /&gt;37&lt;BR /&gt;38 ods html5 (id=saspy_internal) close;ods listing;&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; sas.symput("PRODUCT2", "PROD2", quoting=None);print(sas.lastlog())&lt;/P&gt;
&lt;P&gt;40&lt;BR /&gt;41 %let PRODUCT2=PROD2;&lt;BR /&gt;42&lt;BR /&gt;43&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; sas.symput("PROD2_ATTRIBUTE_SPEC_LIMIT", "96");print(sas.lastlog())&lt;/P&gt;
&lt;P&gt;45&lt;BR /&gt;46 %let PROD2_ATTRIBUTE_SPEC_LIMIT=%NRBQUOTE(96);&lt;BR /&gt;47&lt;BR /&gt;48&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; sas.submitLOG('''&lt;BR /&gt;... %PUT Triple Ampersand result is &amp;amp;&amp;amp;&amp;amp;PRODUCT2._ATTRIBUTE_SPEC_LIMIT;&lt;BR /&gt;... %PUT Single Ampersand result is &amp;amp;PROD2_ATTRIBUTE_SPEC_LIMIT;&lt;BR /&gt;... ''')&lt;/P&gt;
&lt;P&gt;50 ods listing close;ods html5 (id=saspy_internal) file=stdout options(bitmap_mode='inline') device=svg style=HTMLBlue; ods&lt;BR /&gt;50 ! graphics on / outputfmt=png;&lt;BR /&gt;NOTE: Writing HTML5(SASPY_INTERNAL) Body file: STDOUT&lt;BR /&gt;51&lt;BR /&gt;52&lt;BR /&gt;53 %PUT Triple Ampersand result is &amp;amp;&amp;amp;&amp;amp;PRODUCT2._ATTRIBUTE_SPEC_LIMIT;&lt;BR /&gt;Triple Ampersand result is 96&lt;BR /&gt;54 %PUT Single Ampersand result is &amp;amp;PROD2_ATTRIBUTE_SPEC_LIMIT;&lt;BR /&gt;Single Ampersand result is 96&lt;BR /&gt;55&lt;BR /&gt;56&lt;BR /&gt;57 ods html5 (id=saspy_internal) close;ods listing;&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps,&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2024 19:15:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/914281#M360257</guid>
      <dc:creator>sastpw</dc:creator>
      <dc:date>2024-02-02T19:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/914329#M360276</link>
      <description>&lt;P&gt;That would explain it.&lt;/P&gt;
&lt;P&gt;It also explains why the SAS log showed that message about having unquoting something.&lt;/P&gt;
&lt;PRE&gt;SYMBOLGEN:  Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can recreate the issue using SAS code by adding the %NRBQUOTE() when defining PRODUCT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;1    options symbolgen ;
2    %LET PRODUCT = %nrbquote(PROD1);
3    %LET PROD1_ATTRIBUTE_SPEC_LIMIT = 95;
4
5    %PUT Triple Ampersand result is &amp;amp;&amp;amp;&amp;amp;PRODUCT._ATTRIBUTE_SPEC_LIMIT;
SYMBOLGEN:  &amp;amp;&amp;amp; resolves to &amp;amp;.
SYMBOLGEN:  Macro variable PRODUCT resolves to PROD1
SYMBOLGEN:  Some characters in the above value which were subject to macro quoting have been unquoted for printing.
Triple Ampersand result is &amp;amp;PROD1_ATTRIBUTE_SPEC_LIMIT
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2024 21:35:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/914329#M360276</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-02T21:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/914377#M360300</link>
      <description>&lt;P&gt;Ah, the dreaded %NRBQUOTE.&amp;nbsp; It's so easy to think the NR stands "no-resolve" but in fact it stands for "no-rescan" so this lack of making a second pass to fully resolve the text makes perfect sense now. Thanks!&lt;BR /&gt;&lt;BR /&gt;Personally, I've never managed to find even a contrived use-case where %NRBQUOTE was more helpful than %BQUOTE, so I'm surprised that SASPy developers would decide to choose it as a default rather than %BQUOTE.&amp;nbsp; If anyone does have an example where %NRBQUOTE provides important functionality that cannot be obtained by %BQUOTE, please share.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Generally, the idea of automatically adding macro quoting feels a bit foreign to SAS.&amp;nbsp; I can't think of another example where values are quoted without the explicit using of a quoting function.&amp;nbsp; But that said, the world of macro quoting is a murky place. So perhaps there was good reason to add automatic quoting, especially when passing text between languages (python and SAS).&lt;/P&gt;</description>
      <pubDate>Sat, 03 Feb 2024 13:59:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/914377#M360300</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-02-03T13:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/914523#M360370</link>
      <description>&lt;P&gt;Hey sorry for the confusion. I can speak to 'why' the SASPy developer chose this, as that's me. One of the goals of SASPy is for it to be intuitive for Python developers and not require intimate knowledge of SAS, it's syntax and it's idiosyncrasies. That's a goal, and clearly not 100% achievable, since SAS has so many options and syntaxes ... Still, the provided methods try to be Pythonic instead of SAS-centric. With the submit methods, you can code anything the SAS way, so you always have that.&lt;/P&gt;
&lt;P&gt;The goal of symput is to take the value of a Python variable/literal, and make that value exist in SAS as a macro variable. The default for this method is then to make the string from Python be that same string in SAS. Without using the quoting functions, no end of various characters will be parsed/interpreted/changed thus not having the actual Python value be what's in SAS. Of course, providing the option to allow SAS coders to specify special SAS'ism cases is available on the method; thus providing the ability to still get whichever different behavior you want from SAS if you understand the macro language and interpreter. But the default allows real python values to be transferred over without SAS changing them. There's more explanation here:&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/n0o0rjikrg6iezn1ltra79iamibr.htm#p1sufyjjx361jbn1pnek9gv2cfwl" target="_self"&gt;Understanding Why Macro Quoting Is Necessary&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope that helps provide perspective on why the default wasn't what you were expecting.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 15:31:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/914523#M360370</guid>
      <dc:creator>sastpw</dc:creator>
      <dc:date>2024-02-05T15:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/914526#M360372</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/143096"&gt;@sastpw&lt;/a&gt;&amp;nbsp;that makes complete sense that automatic macro quoting is a useful feature for Pythonic folks, and that's the goal of SASpy.&amp;nbsp; I wasn't thinking from a Pythonic perspective.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would still vote for %BQUOTE by default instead of %NRBQUOTE, because I don't think %NRBQUOTE adds any value vs %BQUOTE.&amp;nbsp; And in this case %NRBQUOTE is causing a problem.&amp;nbsp; But that's just quibbling.&amp;nbsp; The choice to have automatic default quoting makes sense, and you've added (and documented) features to allow folks to who understand macro quoting to implement whatever they need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 15:43:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/914526#M360372</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-02-05T15:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/914527#M360373</link>
      <description>&lt;P&gt;That's for your understanding&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;. From the SAS doc for %BQUOTE, it states:&amp;nbsp;In addition, %NRBQUOTE masks: &amp;amp; %.&lt;/P&gt;
&lt;P&gt;So, again, it's just to allow Python strings to be used in SAS as they are, not interpreted/converted as/to something different - by default.&lt;/P&gt;
&lt;P&gt;SAS is tough in that there are multiple ways to get the same behavior from different things and to get different behavior from the same thing!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 15:53:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/914527#M360373</guid>
      <dc:creator>sastpw</dc:creator>
      <dc:date>2024-02-05T15:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/914528#M360374</link>
      <description>&lt;P&gt;It might be useful to add options to the symput python function to add actual quotes to the values.&amp;nbsp; &amp;nbsp;Then the generated macro variables could be used directly in places where SAS syntax needs a quoted value. And if you used single quotes then macro quoting would not be needed.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Say you had the value of&amp;nbsp;&lt;FONT face="courier new,courier"&gt;O'Malley&lt;/FONT&gt; mentioned in the macro documentation.&amp;nbsp; It would be nice to be able to directly create a macro variable with the value&amp;nbsp;&lt;FONT face="courier new,courier"&gt;"O'Malley"&lt;/FONT&gt; or &lt;FONT face="courier new,courier"&gt;'O''Malley'&lt;/FONT&gt; so that you could use it in code like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where charvar = &amp;amp;mvar &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Feb 2024 15:53:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/914528#M360374</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-05T15:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/914534#M360379</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/143096"&gt;@sastpw&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;That's for your understanding&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;. From the SAS doc for %BQUOTE, it states:&amp;nbsp;In addition, %NRBQUOTE masks: &amp;amp; %.&lt;/P&gt;
&lt;P&gt;So, again, it's just to allow Python strings to be used in SAS as they are, not interpreted/converted as/to something different - by default.&lt;/P&gt;
&lt;P&gt;SAS is tough in that there are multiple ways to get the same behavior from different things and to get different behavior from the same thing!&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;%NRBQUOTE doesn't actually mask &amp;amp; or % which look to SAS like macro triggers, sadly.&amp;nbsp; I've read the docs on %NRBQUOTE too many times to remember.&amp;nbsp; The current docs (&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/mcrolref/p0frhtfqvguv78n1owh5wfeopdrj.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/mcrolref/p0frhtfqvguv78n1owh5wfeopdrj.htm&lt;/A&gt;&amp;nbsp;)just say:&lt;/P&gt;
&lt;PRE&gt;The %NRBQUOTE function is useful when you want a value to be resolved when first encountered, if possible, but you do not want any ampersands or percent signs in the result to be interpreted as operators by an %EVAL function.&lt;/PRE&gt;
&lt;P&gt;I think relating to &amp;amp;, it means that %NRBQUOTE will prevent &amp;amp; from meaning AND.&amp;nbsp; So if you have an &amp;amp; that is not a macro trigger (because it's not followed by an alpha character) and you don't want it to be interpreted by %EVAL as meaning AND, then it does that.&amp;nbsp; e.g.:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro nrb(meal=);
  %if %nrbquote(&amp;amp;meal)= %str() %then %put meal=&amp;amp;meal..  Eat Something!;
  %else %put meal=&amp;amp;meal.. Stop eating!;
%mend;
%nrb(meal=Franks &amp;amp; Beans)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But if you pass %nrb(meal=Franks&amp;amp;Beans), you'll get the unresolved macro variable warnings for &amp;amp;Beans, because %nrbquote doesn't stop the macro resolution attempt.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I don't understand what the docs mean about percent signs, because I don't think a percent sign is ever an operator to %EVAL.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So to me, the only use-case I've ever found for %NRBQUOTE was when a value has a solitary &amp;amp;.&amp;nbsp; Which I guess is a use-case, just very limited.&amp;nbsp; But I can accept that for SASPY, that could be one less call to tech support, so could be the right decision.&amp;nbsp; : )&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 16:39:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/914534#M360379</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-02-05T16:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: SASPy and the Macro Processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/914541#M360383</link>
      <description>&lt;P&gt;I'll say right now that I'm sure you know more about SAS Macro than I do. I've never needed to use it enough to understand all of it's obtuse functionality. As for the doc, yes, it has bit's of info scattered over different pages and sometimes it's misleading or contradicts itself in different places. The doc I was looking at about it saying &amp;amp; and % is just a different&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p06cx7fegzmzpen1m9991yljxiav.htm" target="_self"&gt;page&lt;/A&gt;. I don't know if it's accurate or not. I can't say I tested every possibility of macro strings when implementing symput.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, given that you can choose any or none of the various macro functions when using symput, or code any way you want with submit, and the fact that I don't make breaking changes to SASPy if I can possibly help it, I'm not inclined to change the default behavior for this and take the chance of breaking someone's code that's already working as they want and expect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Again, I appreciate your understanding on this!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 17:05:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SASPy-and-the-Macro-Processor/m-p/914541#M360383</guid>
      <dc:creator>sastpw</dc:creator>
      <dc:date>2024-02-05T17:05:58Z</dc:date>
    </item>
  </channel>
</rss>

