<?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: Nested macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Nested-macro/m-p/147264#M29217</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I find it hard to imagine how nesting the compilation of macros would become helpful or neccessary.&lt;/P&gt;&lt;P&gt;Please explain the perceived benefits.&lt;/P&gt;&lt;P&gt; Macros can achieve much more diverse complexity in other ways. &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;It is not often helpful.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To invoke a list processing engine I crafted a macro that invokes that engine - the core looked like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&amp;amp;execut&lt;/P&gt;&lt;P&gt;where &amp;amp;execut names the (macro) process to be applied repeatedly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a SUGI paper on this&amp;nbsp; - search for mloopsx at &lt;A href="http://www.lexjansen.com"&gt;http://www.lexjansen.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Dec 2014 08:41:25 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2014-12-12T08:41:25Z</dc:date>
    <item>
      <title>Nested macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-macro/m-p/147261#M29214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Forum,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was&amp;nbsp; trying to come up with some macro code to understand nested macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options mprint mlogic symbolgen;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %macro test1(parm1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %macro test(par);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc print data=&amp;amp;par;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %mend test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %test(&amp;amp;parm1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %mend test1;&lt;/P&gt;&lt;P&gt;%test1(sashelp.class);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this valid way to write nested macro&amp;nbsp; or are&amp;nbsp; there alternatives&amp;nbsp; for this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks !!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Dec 2014 23:16:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-macro/m-p/147261#M29214</guid>
      <dc:creator>kaushal2040</dc:creator>
      <dc:date>2014-12-11T23:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: Nested macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-macro/m-p/147262#M29215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nesting macro definitions is possible but seldom actually needed. I would spend more time on learning how to pass parameters and control logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your program logic doesn't lead you to wanting to have a %macro &amp;amp;nestedmacroname (); kind of statement you probably don't need to nest a macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Debugging a program with a nested macro can become extremely difficult in very short order.&lt;/P&gt;&lt;P&gt;Another reason to avoid the nested construction is for a macro called frequently the nested macro are recompiled every execution, which can result in a performance hit, especially the resulting nested macros are generally the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A more esoteric argument against them is if using the SOURCE option for saving a macro in a permanent macro catalog does not work for the nested macros. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2014 00:14:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-macro/m-p/147262#M29215</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-12-12T00:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: Nested macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-macro/m-p/147263#M29216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is the execution of the macros that can be nested, not the definition. &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;In fact writing that way will just make it harder to maintain the code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;In your example you are simply calling the macro TEST from within the execution of TEST1.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%macro test(par);&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc print data=&amp;amp;par;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%mend test;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%macro test1(parm1);&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %test(&amp;amp;parm1);&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%mend test1;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%test1(sashelp.class);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2014 00:16:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-macro/m-p/147263#M29216</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-12-12T00:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: Nested macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-macro/m-p/147264#M29217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I find it hard to imagine how nesting the compilation of macros would become helpful or neccessary.&lt;/P&gt;&lt;P&gt;Please explain the perceived benefits.&lt;/P&gt;&lt;P&gt; Macros can achieve much more diverse complexity in other ways. &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;It is not often helpful.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To invoke a list processing engine I crafted a macro that invokes that engine - the core looked like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&amp;amp;execut&lt;/P&gt;&lt;P&gt;where &amp;amp;execut names the (macro) process to be applied repeatedly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a SUGI paper on this&amp;nbsp; - search for mloopsx at &lt;A href="http://www.lexjansen.com"&gt;http://www.lexjansen.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2014 08:41:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-macro/m-p/147264#M29217</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2014-12-12T08:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: Nested macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-macro/m-p/147265#M29218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks ballardw, Tom, and Peter.C.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2014 15:11:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-macro/m-p/147265#M29218</guid>
      <dc:creator>kaushal2040</dc:creator>
      <dc:date>2014-12-12T15:11:32Z</dc:date>
    </item>
  </channel>
</rss>

