<?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: Including self written Macro functions in other programs - Best Practice in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Including-self-written-Macro-functions-in-other-programs-Best/m-p/754547#M237970</link>
    <description>&lt;P&gt;I recommend using an &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/n1o5fkxq0gqdpcn1xs3ksdks69tf.htm" target="_self"&gt;AUTOCALL macro library&lt;/A&gt;, for the same reasons given in this thread.&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/SAS-Macro-Help-Text-Documentation/m-p/753876#M237672" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/SAS-Macro-Help-Text-Documentation/m-p/753876#M237672&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use an AUTOCALL library. I haven't typed %include since the 16th century.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The disadvantage of using %include to include a file with about 40 macros is that all these macros have to be compiled at the time the %include command is issued, and this may take a minute or so (I don't know, they're not my macros). Further disadvantage of having 40 macros in one file is that they become difficult to manage and/or modify in one file. First, you have to find the macro you want to modify. Then, don't make a mistake when you modify it! If there is a mistake in one of the macros, it could affect every macro below it, or you could accidentally modify other macros.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jul 2021 10:48:08 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-07-16T10:48:08Z</dc:date>
    <item>
      <title>Including self written Macro functions in other programs - Best Practice</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-self-written-Macro-functions-in-other-programs-Best/m-p/754542#M237968</link>
      <description>&lt;P&gt;I am working in an organization where there are multiple users and multiple people write custom macros that are included in other programs. Programs and macros are saved in servers&amp;nbsp;(not on local computer memory) so it is accessible to multiple people - I give this background information since it could affect the arguments against and for below.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;To make the macros available, we simply use %include statements in the programs where one %include file can contain around 40 macros and then use them. This works fine, but I am curious of if there are any "best practices" or recommendations on how to "professionally" do it. Arguments for and against are appreciated and any best practices aswell.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 10:21:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-self-written-Macro-functions-in-other-programs-Best/m-p/754542#M237968</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2021-07-16T10:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: Including self written Macro functions in other programs - Best Practice</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-self-written-Macro-functions-in-other-programs-Best/m-p/754547#M237970</link>
      <description>&lt;P&gt;I recommend using an &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/n1o5fkxq0gqdpcn1xs3ksdks69tf.htm" target="_self"&gt;AUTOCALL macro library&lt;/A&gt;, for the same reasons given in this thread.&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/SAS-Macro-Help-Text-Documentation/m-p/753876#M237672" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/SAS-Macro-Help-Text-Documentation/m-p/753876#M237672&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use an AUTOCALL library. I haven't typed %include since the 16th century.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The disadvantage of using %include to include a file with about 40 macros is that all these macros have to be compiled at the time the %include command is issued, and this may take a minute or so (I don't know, they're not my macros). Further disadvantage of having 40 macros in one file is that they become difficult to manage and/or modify in one file. First, you have to find the macro you want to modify. Then, don't make a mistake when you modify it! If there is a mistake in one of the macros, it could affect every macro below it, or you could accidentally modify other macros.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 10:48:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-self-written-Macro-functions-in-other-programs-Best/m-p/754547#M237970</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-16T10:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: Including self written Macro functions in other programs - Best Practice</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-self-written-Macro-functions-in-other-programs-Best/m-p/754589#M237990</link>
      <description>&lt;P&gt;Agree, read up on setting up and using autocall libraries.&amp;nbsp; They're wonderful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And note your SAS program can determine which autocall libraries it uses, they they will be searched in order.&amp;nbsp; Every SAS session (by default) already has an autocall library, with macros provided by SAS.&amp;nbsp; So you can add say a corporate macro library, and even a project-specific macro library.&amp;nbsp; Then when you call a macro, it will look in project-specific macro library to see if it exists, then look in the corporate library, then look in the SAS default library.&amp;nbsp; It's great.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I first started writing general purpose macros for my own use, I used the %include method.&amp;nbsp; I had one&amp;nbsp; .sas file for each macro.&amp;nbsp; So I had a folder with say 30 .sas files.&amp;nbsp; Then I had one .sas file LoadMacros.sas which&amp;nbsp; was a list of 30 %include statements.&amp;nbsp; &amp;nbsp;At the start of a program, I would %include LoadMacros.sas, and it would compile all the macros.&amp;nbsp; But that was basically just a hack that felt useful until I learned about the benefits of using an autocall library.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you go to lexjansen.com, you should find plenty of papers about setting up and managing autocall libraries. They work great, for teams and individuals.&amp;nbsp; Or buy Art Carpenter's macro programming book.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 13:52:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-self-written-Macro-functions-in-other-programs-Best/m-p/754589#M237990</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2021-07-16T13:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Including self written Macro functions in other programs - Best Practice</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-self-written-Macro-functions-in-other-programs-Best/m-p/754592#M237993</link>
      <description>&lt;P&gt;Regarding project specific macros, I have created different AUTOEXEC files for different projects, so it can access the specific AUTOCALL macro I need for a specific project, but perhaps set other options as well (such as output folders, titles or footnotes,&amp;nbsp;&lt;EM&gt;etc&lt;/EM&gt;., access to databases) that would be specific to this project.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 13:57:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-self-written-Macro-functions-in-other-programs-Best/m-p/754592#M237993</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-16T13:57:15Z</dc:date>
    </item>
  </channel>
</rss>

