<?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: Calling a macro with the macro name stored in a macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527397#M143770</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/98621"&gt;@BenF&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks! The reason that the macro name is quoted is that it is resolved by&lt;BR /&gt;a macro call that is also used to return code fragments that need to be&lt;BR /&gt;quoted. &lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't understand can you explain or show and example.&lt;/P&gt;</description>
    <pubDate>Tue, 15 Jan 2019 17:18:57 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2019-01-15T17:18:57Z</dc:date>
    <item>
      <title>Calling a macro with the macro name stored in a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527380#M143765</link>
      <description>&lt;P&gt;I'm calling a macro where the macro name to be called is stored in a macro variable. I don't understand the behavior I'm seeing. The actual code is more complicated, but it boils down to this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%macro child(d=, t=, p=);

&amp;nbsp; %put CHILD&amp;gt;&amp;gt;&amp;gt; d = [&amp;amp;d];
&amp;nbsp; %put CHILD&amp;gt;&amp;gt;&amp;gt; t = [&amp;amp;t];
&amp;nbsp; %put CHILD&amp;gt;&amp;gt;&amp;gt; p = [&amp;amp;p];

%mend child;


%macro parent;
&amp;nbsp; %local dsn tab path macroName;

&amp;nbsp; %let macroName = &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;%bquote(child);&lt;/FONT&gt;&lt;/STRONG&gt;
&amp;nbsp; %let dsn = testDsn;
&amp;nbsp; %let tab = testTab;
&amp;nbsp; %let path = testPath;

&amp;nbsp; %put PARENT&amp;gt;&amp;gt;&amp;gt; macroName = [&amp;amp;macroName];
&amp;nbsp; %put PARENT&amp;gt;&amp;gt;&amp;gt; dsn = [&amp;amp;dsn];
&amp;nbsp; %put PARENT&amp;gt;&amp;gt;&amp;gt; tab = [&amp;amp;tab];
&amp;nbsp; %put PARENT&amp;gt;&amp;gt;&amp;gt; path = [&amp;amp;path];

&amp;nbsp; %&amp;amp;macroName(d=&amp;amp;dsn, t=&amp;amp;tab, p=&amp;amp;path);
%mend parent;

%parent;&lt;/PRE&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;What I see when I run this interactively using SAS Studio 3.6 running&amp;nbsp;&lt;STRONG&gt;SAS release:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;9.04.01M4P11092016 is:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt;PARENT&amp;gt;&amp;gt;&amp;gt; macroName = [child]
PARENT&amp;gt;&amp;gt;&amp;gt; dsn = [testDsn]
PARENT&amp;gt;&amp;gt;&amp;gt; tab = [testTab]
PARENT&amp;gt;&amp;gt;&amp;gt; path = [testPath]
CHILD&amp;gt;&amp;gt;&amp;gt; d = []
CHILD&amp;gt;&amp;gt;&amp;gt; t = []
CHILD&amp;gt;&amp;gt;&amp;gt; p = []
NOTE: Line generated by the invoked macro "PARENT".
86 %&amp;amp;macroName(d=&amp;amp;dsn, t=&amp;amp;tab, p=&amp;amp;path);
_
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
&amp;nbsp;
MPRINT(PARENT): (d=testDsn, t=testTab, p=testPath);&lt;/PRE&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Notes:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;1. With the macro name as a quoted macro variable (red highlight), it looks like the macro gets called with no arguments.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;2. It works as expected if the macro name is not quoted.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;3. I could not find anything about this behavior using a web search.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;4. For those questioning WHY I would want to do this: I have a cross study, data-driven utility that is used to create Excel subject line listing. I am extending it to allow for custom Excel tabs where I can do things like highlight specific cells.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;5. For those wondering WHY I'm asking when I have a workaround: The macro facility is sometimes mysterious to me. I just want to better understand what is going on. It took me a while to debug this...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Thanks for your help.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Ben&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 16:46:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527380#M143765</guid>
      <dc:creator>BenF</dc:creator>
      <dc:date>2019-01-15T16:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro with the macro name stored in a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527387#M143766</link>
      <description>&lt;P&gt;You don't need to use %BQUOTE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let macroName = &lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;%bquote(child);&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can just assign Child to macroname.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 16:56:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527387#M143766</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2019-01-15T16:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro with the macro name stored in a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527389#M143767</link>
      <description>&lt;P&gt;This works if you take out the %bquote, as there seems to be no need to use macro quoting on the text string child&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If for some reason you have to have %bquote (and I can't think of such a reason, because valid names of an actual macro should not need to be surrounded by the %bquote() function), then you want to use&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let macroName = %unquote(%bquote(child));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For an explanation of why %unquote would be needed there, I call upon Mr.&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;who can explain this a lot better than I can.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 17:01:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527389#M143767</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-15T17:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro with the macro name stored in a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527396#M143769</link>
      <description>Thanks! The reason that the macro name is quoted is that it is resolved by&lt;BR /&gt;a macro call that is also used to return code fragments that need to be&lt;BR /&gt;quoted. Yes, the unquote works. I look forward to an nth degree macro ninja&lt;BR /&gt;explaining what is going on.&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Jan 2019 17:12:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527396#M143769</guid>
      <dc:creator>BenF</dc:creator>
      <dc:date>2019-01-15T17:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro with the macro name stored in a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527397#M143770</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/98621"&gt;@BenF&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks! The reason that the macro name is quoted is that it is resolved by&lt;BR /&gt;a macro call that is also used to return code fragments that need to be&lt;BR /&gt;quoted. &lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't understand can you explain or show and example.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 17:18:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527397#M143770</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2019-01-15T17:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro with the macro name stored in a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527398#M143771</link>
      <description>As I said, the actual code is more complicated. I want to know why having a&lt;BR /&gt;quoted macro variable in the call breaks the call.&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Jan 2019 17:21:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527398#M143771</guid>
      <dc:creator>BenF</dc:creator>
      <dc:date>2019-01-15T17:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro with the macro name stored in a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527407#M143773</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/98621"&gt;@BenF&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks! The reason that the macro name is quoted is that it is resolved by&lt;BR /&gt;a macro call that is also used to return code fragments that need to be&lt;BR /&gt;quoted. Yes, the unquote works. I look forward to an nth degree macro ninja&lt;BR /&gt;explaining what is going on.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Even in the case where you don't have the five letter text string&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;child&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and you have a macro variable named (for example) &amp;amp;myvar, you still don't need %bquote if &amp;amp;myvar has to be the name of a macro, which it has to be in this example. Not only does %bquote do nothing here, but as you can see it causes other problems. Now if &amp;amp;myvar can contains special characters that have a meaning to the macro processor, for example if the value of &amp;amp;myvar is&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dan+Shay&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;then %bquote would be needed to prevent the macro processor from understanding the + sign as an actual + sign indicating addition, and inside %bquote the + sign would then be interpreted as text which doesn't indicate addition. But if you have the name of a macro in &amp;amp;myvar, then it can't have a + sign (or any other character with special meaning).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, I still struggle to explain %unquote. Basically, I know that if the resolution of the macro seems to be the correct text which results in valid legal SAS code, but produces an error, then %unquote fixes the problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 17:46:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527407#M143773</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-15T17:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro with the macro name stored in a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527410#M143774</link>
      <description>Thanks!&lt;BR /&gt;&lt;BR /&gt;I don't want to get too far off topic, but the quoting in the actual code&lt;BR /&gt;is needed for exactly the reason you describe. The macro name is resolved&lt;BR /&gt;using the same macro that is returning SAS code fragments, which need to be&lt;BR /&gt;quoted.&lt;BR /&gt;&lt;BR /&gt;I'm really just interested in why SAS fails in this case. It took me a&lt;BR /&gt;while to figure this out and it seems like a non-intuitive behavior (ie,&lt;BR /&gt;the macro does gets called but no arguments are passed).&lt;BR /&gt;&lt;BR /&gt;Boring Details&lt;BR /&gt;-------------------&lt;BR /&gt;I'm creating EXCEL reports that are defined using data stored in formats.&lt;BR /&gt;At run time, I read the report definitions from the formats and construct&lt;BR /&gt;the report. In this way, I'm able to create reports for many different&lt;BR /&gt;studies without having custom SAS programs (other than study-specific&lt;BR /&gt;driver programs that just define a bunch of formats that define the reports&lt;BR /&gt;to create).&lt;BR /&gt;&lt;BR /&gt;Here are some examples from the report definitions::&lt;BR /&gt;proc format;&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;/* Tab -&amp;gt; Report Subset */&lt;BR /&gt;&lt;BR /&gt;value $rptSub&lt;BR /&gt;&lt;BR /&gt;'R_AE_COMP' = "ADSL.R|RCTRANFL='Y'"&lt;BR /&gt;&lt;BR /&gt;'R_AEs' = "FINAL.R|WITHIN30='Y' and SER='Yes'&lt;BR /&gt;&lt;BR /&gt;#ADSL.R|RCTRANFL='Y'"&lt;BR /&gt;&lt;BR /&gt;'R_LGRSAEs' = "FINAL.R|LGRSAE_YN='Y'&lt;BR /&gt;&lt;BR /&gt;#ADSL.R|RCTRANFL='Y'"&lt;BR /&gt;&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;/* Optional: Tab -&amp;gt; Custom Macro Name to handle dump to Excel */&lt;BR /&gt;&lt;BR /&gt;value $rptHdlr&lt;BR /&gt;&lt;BR /&gt;'R_AE_COMP' = 'lineList_Default_RptHdlr'&lt;BR /&gt;&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;So at run-time, I pull the SAS fragment from $rptSub and use that to subset&lt;BR /&gt;the data for the report. That needs to be quoted. The same macro that pulls&lt;BR /&gt;the report subset also pulls the name of the macro to use in the rare case&lt;BR /&gt;that a custom macro is needed to do the dumping of the data into EXCEL.&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Jan 2019 18:08:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527410#M143774</guid>
      <dc:creator>BenF</dc:creator>
      <dc:date>2019-01-15T18:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro with the macro name stored in a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527413#M143776</link>
      <description>&lt;P&gt;Very interesting question. Here is my wild guess&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; %let macroName = %bquote(child);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;%&amp;amp;macroName(d=&amp;amp;dsn, t=&amp;amp;tab, p=&amp;amp;path);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.At compile time, when tokenisation takes place, the %bquote tells the macro processor, that the "quoted value" of&amp;nbsp; macroname aka a text called&amp;nbsp; child would have be stored as value. The quoted value remains in effect until the execution of %macro parent is complete.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. When %macro child is successfully compiled, an entry of the compiled macro definition is stored in work.sasmacr catalog. However when called from %macro parent, the quoted value despite a prefix of macro trigger&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;&amp;nbsp;%&lt;/STRONG&gt;&amp;amp;macroName remains in effect.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3. What apparently that means is, the macro call does not look for quoted text in the work.sasmacr catalog to execute.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;4. This is almost like having a global and local macro variable with the same name, hmm I am afraid perhaps not the best analogy&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;5. I suppose the resolved&amp;nbsp;&amp;nbsp;%&amp;amp;macroName value&amp;nbsp;&amp;nbsp;%child would mean %remainsquoted(child)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;6. %unquote would of course work, but the charm is to understand the length of the duration of value to be remain quoted for macro processor to not interpret as a macro call.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;All the above is my own guess. Kindly forgive me if nothing is true/makes any sense.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 18:13:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527413#M143776</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-15T18:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro with the macro name stored in a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527414#M143777</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/98621"&gt;@BenF&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I don't want to get too far off topic, but the quoting in the actual code&amp;nbsp;is needed for exactly the reason you describe. The macro name is resolved using the same macro that is returning SAS code fragments, which need to be quoted.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;
&lt;P&gt;&lt;SPAN&gt;So at run-time, I pull the SAS fragment from $rptSub and use that to subset&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;the data for the report. That needs to be quoted.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just because you say it needs to be quoted does not mean that it needs to be quoted. I am not convinced.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It only needs to be quoted if it contains special characters that have meaning to the macro processor. You haven't explained how that can be, and even in that case, you can't have a macro name that contains these special characters. So mark me down as not believing that you need to quote the macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I leave it to Mr.&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;to explain the details of why you need an %unquote.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 18:41:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527414#M143777</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-15T18:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro with the macro name stored in a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527435#M143783</link>
      <description>&lt;P&gt;The quoting around the name is confusing the parser such that it no longer recognizes the following text in parentheses as part of the macro call.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So there are two solutions.&amp;nbsp; Define the macro you are calling to not have any parameters (or call it without setting any parameter values).&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%&amp;amp;macroName ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or unquote the name before trying to use it.&amp;nbsp; Since you already decided that macroName must have the name of a macro then removing the quoting will not make the program any more unsafe than it already is.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let macroName=%unquote(&amp;amp;macroName);
%&amp;amp;macroName(parm1=,parm2=)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 18:40:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527435#M143783</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-01-15T18:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro with the macro name stored in a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527439#M143785</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;, now you're confusing me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If we simply take the %bquote out of the original code, no %unquote is needed.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 18:45:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527439#M143785</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-15T18:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro with the macro name stored in a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527440#M143786</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;, now you're confusing me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If we simply take the %bquote out of the original code, no %unquote is needed.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Huh?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Wait I think I figured out your question. You are confusing the example code posted to demonstrate the problem and the actual problem. The %BQUOTE() is in the code to show an example of what causes the problem.&amp;nbsp; For example the program might have been using %QSCAN() or %QSYSFUNC() to parse a string into pieces and then later it made a decision that this particular piece should be used as the name of macro.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 18:50:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527440#M143786</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-01-15T18:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro with the macro name stored in a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527451#M143790</link>
      <description>The code I posted was a gross simplification of the actual code. The macro&lt;BR /&gt;name to be called is itself the result of a macro call. The macro called&lt;BR /&gt;returns both macro names (this case -&amp;gt; no quoting needed) and SAS code&lt;BR /&gt;fragments (other places --&amp;gt; quoting needed).&lt;BR /&gt;&lt;BR /&gt;Thanks, Tom for explaining what is going on! I no longer have to wait for&lt;BR /&gt;the movie: "SAS Macro Processing: The Movie (in 3D)". &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Jan 2019 18:58:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-macro-with-the-macro-name-stored-in-a-macro-variable/m-p/527451#M143790</guid>
      <dc:creator>BenF</dc:creator>
      <dc:date>2019-01-15T18:58:02Z</dc:date>
    </item>
  </channel>
</rss>

