<?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: macro calling in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-calling/m-p/782282#M249385</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you running into a problem somewhere?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You just need to make sure that a macro is defined and compiled before it is called.&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;%MACRO ABC; &lt;EM&gt;_some_statements_&lt;/EM&gt;; %MEND; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;... is defining macro ABC. (%MEND can be read as MacroEND by the way).&lt;/P&gt;
&lt;P&gt;When you submit this macro definition, the macro, named ABC, then gets compiled and stored in a catalog.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can call a macro within another macro.&lt;BR /&gt;Make sure to %GLOBAL some macro variables if you need them outside the macro where they are created.&lt;/P&gt;
&lt;P&gt;Data sets created in a first macro can perfectly be used and read and processed in a subsequent macro.&lt;/P&gt;
&lt;P&gt;Data sets are NOT local to the macro where they are created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macro definitions have to be re-run in every SAS session (because the compiled version is stored in WORK library).&lt;/P&gt;
&lt;P&gt;If you want to avoid that, you can use the "stored compiled macro facility" (sasmstore) or the autocall library facility.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure what your problem is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
    <pubDate>Wed, 24 Nov 2021 18:27:58 GMT</pubDate>
    <dc:creator>sbxkoenk</dc:creator>
    <dc:date>2021-11-24T18:27:58Z</dc:date>
    <item>
      <title>macro calling</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-calling/m-p/782281#M249384</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have theoritical question , I might able to explain this with example.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have&amp;nbsp; 3 macros macroA , macroB and macroC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;execution of those is like shown below.&lt;/P&gt;
&lt;P&gt;%macro macroA;&lt;/P&gt;
&lt;P&gt;some Sas codes&lt;/P&gt;
&lt;P&gt;%mend macroA;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro macroB;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; %macroA&lt;/P&gt;
&lt;P&gt;Along with some Sas codes which may use output of macroA&lt;/P&gt;
&lt;P&gt;%mend macroB;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro macroC;&lt;/P&gt;
&lt;P&gt;some Sas codes&lt;/P&gt;
&lt;P&gt;%mend macroC;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macroB;&lt;/P&gt;
&lt;P&gt;%macro C;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now if want to call macroA How&amp;nbsp; can we do that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also if I am doing like this will this impact anything ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro macroA;&lt;/P&gt;
&lt;P&gt;some Sas codes&lt;/P&gt;
&lt;P&gt;%mend macroA;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macroA;&amp;nbsp; &amp;nbsp; &amp;nbsp; /* caling this outside macroB*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro macroB;&lt;/P&gt;
&lt;P&gt;Along with some Sas codes which may use output of macroA&lt;/P&gt;
&lt;P&gt;%mend macroB;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro macroC;&lt;/P&gt;
&lt;P&gt;some Sas codes&lt;/P&gt;
&lt;P&gt;%mend macroC;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macroB;&lt;/P&gt;
&lt;P&gt;%macro C;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P aria-hidden="true"&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>Wed, 24 Nov 2021 18:14:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-calling/m-p/782281#M249384</guid>
      <dc:creator>Aexor</dc:creator>
      <dc:date>2021-11-24T18:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: macro calling</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-calling/m-p/782282#M249385</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you running into a problem somewhere?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You just need to make sure that a macro is defined and compiled before it is called.&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;%MACRO ABC; &lt;EM&gt;_some_statements_&lt;/EM&gt;; %MEND; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;... is defining macro ABC. (%MEND can be read as MacroEND by the way).&lt;/P&gt;
&lt;P&gt;When you submit this macro definition, the macro, named ABC, then gets compiled and stored in a catalog.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can call a macro within another macro.&lt;BR /&gt;Make sure to %GLOBAL some macro variables if you need them outside the macro where they are created.&lt;/P&gt;
&lt;P&gt;Data sets created in a first macro can perfectly be used and read and processed in a subsequent macro.&lt;/P&gt;
&lt;P&gt;Data sets are NOT local to the macro where they are created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macro definitions have to be re-run in every SAS session (because the compiled version is stored in WORK library).&lt;/P&gt;
&lt;P&gt;If you want to avoid that, you can use the "stored compiled macro facility" (sasmstore) or the autocall library facility.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure what your problem is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2021 18:27:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-calling/m-p/782282#M249385</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-11-24T18:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: macro calling</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-calling/m-p/782314#M249389</link>
      <description>&lt;P&gt;Agreeing with &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60547"&gt;@sbxkoenk&lt;/a&gt; — not sure what the problem is here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/327170"&gt;@Aexor&lt;/a&gt;, you could try it both ways and see what happens. I'm not sure why you haven't done that already.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2021 20:53:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-calling/m-p/782314#M249389</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-24T20:53:49Z</dc:date>
    </item>
  </channel>
</rss>

