<?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: the performance of  some sas macro programs in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314582#M68535</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick﻿&lt;/a&gt; thank you again for this details.&lt;/P&gt;
&lt;P&gt;You have given this exemple&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro outer;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %macro inner;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %inner;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; %mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, what about this one without calling %inner ?&lt;/P&gt;
&lt;P&gt;%macro outer;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %macro inner;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %mend;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Really, I agree with your explanations and Mister &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom﻿&lt;/a&gt;, Is it possible to see some beugs created by the used of "macro nest" ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you again&lt;/P&gt;</description>
    <pubDate>Sun, 27 Nov 2016 11:07:12 GMT</pubDate>
    <dc:creator>LineMoon</dc:creator>
    <dc:date>2016-11-27T11:07:12Z</dc:date>
    <item>
      <title>the performance of  some sas macro programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314494#M68507</link>
      <description>&lt;P&gt;Hello experts,&lt;/P&gt;
&lt;P&gt;Please, I want to ask some questions about the performance of sas macro -programs .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The first one: increasing the number of sas macro-programs in sas application&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What's about the performance of the sas application, if we increase the number of sas maco-programs.&lt;/P&gt;
&lt;P&gt;For exemple passing from 40 sas macro-programs to 1000 or more ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The scond one about the writing of some sas macro -programs on the performance&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;implrication of sas macro-programs&lt;BR /&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%marco test;&lt;/P&gt;
&lt;P&gt;......&lt;/P&gt;
&lt;P&gt;.....&lt;/P&gt;
&lt;P&gt;%macro test2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%mend test2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro testn;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%mend testn;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;.....&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;%Mend test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Sas macro-program without %mend&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro try;&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;%try;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Nov 2016 23:24:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314494#M68507</guid>
      <dc:creator>LineMoon</dc:creator>
      <dc:date>2016-11-26T23:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: the performance of  some sas macro programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314502#M68510</link>
      <description>&lt;P&gt;Don't nest macros.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2016 00:43:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314502#M68510</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-27T00:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: the performance of  some sas macro programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314529#M68515</link>
      <description>&lt;P&gt;Your questions are too generic to give you a real answer. How your macros perform depends very much on how you code them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On what level do you care about performance impact? Miliseconds or minutes?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macro compilation as such doesn't take much time. I've seen some discussions where searching for not yet compiled macros could take up to a second (as it requires creating directory listing of all paths in the SASAUTO's path - you can pre-compile macros though if this is of concern).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt;&amp;nbsp;meant by "don't nest macros" is "don't nest macro definitions" as this will lead to the inner macro being compiled every single time you call the outer macro.&lt;/P&gt;
&lt;P&gt;%macro outer;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %macro inner;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %inner;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead write things as below&amp;nbsp;as then the macros get compiled only once no matter how often you call them.&lt;/P&gt;
&lt;P&gt;%macro inner;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;%mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro outer;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %inner;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And then: To keep code maintainable don't nest too many macro calls (=macro calling macro calling macro). It makes debugging really hard in case something goes wrong.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2016 03:40:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314529#M68515</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2016-11-27T03:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: the performance of  some sas macro programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314532#M68516</link>
      <description>&lt;P&gt;Performance generally depends on what the macros are doing rather than the number of them. &amp;nbsp;How you do things also makes a difference (whether using macro code or not). &amp;nbsp;If you need to calculate sums for 100 groups use BY group processing to do it one step instead of looping 100 times&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Having hundreds of macros will be difficult to maintain and use. &amp;nbsp;Users won't know which one to use. I would tend to having fewer macros if you can. &amp;nbsp;If the macros are being used frequently then it is worth the effort to make them efficient and bug free.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do not nest macro definitions. There is no reason to do that. &amp;nbsp;Having the macro definition inside of another macro's defintion does NOT imply that the inner macro is some how related to the outer one. &amp;nbsp;It will NOT "inherit" any macro variables or other things from them. The scoping of macro variables is based on when the macro RUN, not when they are defined.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2016 02:59:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314532#M68516</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-11-27T02:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: the performance of  some sas macro programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314582#M68535</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick﻿&lt;/a&gt; thank you again for this details.&lt;/P&gt;
&lt;P&gt;You have given this exemple&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro outer;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %macro inner;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %inner;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; %mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, what about this one without calling %inner ?&lt;/P&gt;
&lt;P&gt;%macro outer;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %macro inner;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %mend;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Really, I agree with your explanations and Mister &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom﻿&lt;/a&gt;, Is it possible to see some beugs created by the used of "macro nest" ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you again&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2016 11:07:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314582#M68535</guid>
      <dc:creator>LineMoon</dc:creator>
      <dc:date>2016-11-27T11:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: the performance of  some sas macro programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314583#M68536</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/44053"&gt;@LineMoon﻿&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;But, what about this one without calling %inner ?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;%macro outer;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; %macro inner;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; %mend;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;%mend;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's just something you shouldn't do at all.&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2016 11:15:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314583#M68536</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2016-11-27T11:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: the performance of  some sas macro programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314585#M68538</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom﻿&lt;/a&gt; : Thank you for answer.&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; I agree with this explanation, but as you know coding depends on the programmer with best practics or not..So is it possible to show in sas "no perfermance of nest macro "&amp;nbsp; with some exemple?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What's also about&amp;nbsp; the using of "%mend" without the name of macro ?&lt;/P&gt;
&lt;P&gt;%macro test;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%mend test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2016 11:21:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314585#M68538</guid>
      <dc:creator>LineMoon</dc:creator>
      <dc:date>2016-11-27T11:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: the performance of  some sas macro programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314586#M68539</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick﻿&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;With some programmers, we can see some things like that.&lt;/P&gt;
&lt;P&gt;So, is it possible to show "the no performance of the two methods " ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Methode 1&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;%macro outer;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %macro inner;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %inner;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Methode 2&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro outer;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %macro inner;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; %mend;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2016 11:27:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314586#M68539</guid>
      <dc:creator>LineMoon</dc:creator>
      <dc:date>2016-11-27T11:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: the performance of  some sas macro programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314607#M68550</link>
      <description>&lt;P&gt;It is good practice to include the macro name in the %MEND statement because it makes the code easier for humans to read and maintain. But it does not change how SAS compiles the macro. &amp;nbsp;SAS will even happily compile the macro with only a WARNING if the names do not match.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2016 15:12:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314607#M68550</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-11-27T15:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: the performance of  some sas macro programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314610#M68552</link>
      <description>&lt;P&gt;Those two programs are not equivalent. &amp;nbsp;The second one does NOT run the %INNER macro.&lt;/P&gt;
&lt;P&gt;There is only a small performance penalty for re-compiling a macro since it does not involve any actual data manipulation.&lt;/P&gt;
&lt;P&gt;The bigger penalty will be paid in maintaining the program source file and in confusion that the nested structure will instill into novice users that might assume there was a valid reason for nesting the macro definitions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Method 1 FIXED&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro inner;
%mend;

%macro outer;
&amp;nbsp; &amp;nbsp; %inner;
%mend;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Method 2 FIXED&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro inner;
%mend;

%macro outer;
%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2016 15:20:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/the-performance-of-some-sas-macro-programs/m-p/314610#M68552</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-11-27T15:20:41Z</dc:date>
    </item>
  </channel>
</rss>

