<?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: Is there a tool to transform a lot of macro files to the Stored Compiled Macro program? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/627985#M185481</link>
    <description>&lt;P&gt;Hi Tom,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have about 250 macro functions. I want to know how many seconds they need to be compiled. But looks like it is not easy to find out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because I may need to schedule my program to run every 15 minutes or every 10 minutes, and I hope using pre-compiled macros could save me some time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Thu, 27 Feb 2020 17:08:59 GMT</pubDate>
    <dc:creator>jjjch</dc:creator>
    <dc:date>2020-02-27T17:08:59Z</dc:date>
    <item>
      <title>Is there a tool to transform a lot of macro files to the Stored Compiled Macro program?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/627747#M185373</link>
      <description>&lt;P&gt;I save each macro function into a SAS file and put them all in my_macro_folder.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*my_macro1.sas file*/
%macro my_macro1();
...
%mend;

/*my_macro2.sas file*/
%macro my_macro2();
...
%mend;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And below is the way that I call those macros.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options sasautos=("my_macro_folder" sasautos);
%my_macro1()
%my_macro2()
...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;As my program evolves and adds more functions, the number of macro functions increases, and my program becomes slower and slower. Recently I noticed that it took 13 minutes to run the first time, then 8 minutes to run the second time for the exact same input.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What are the possible ways to speed up the program?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks like switching to the stored compiled macro programs is a way of improving the efficiency. Then I will need to add " / store source" to each macro function and combine them into one file like below. Is there a tool to do it automatically? Because I would like to keep using the sasautos way to develop and test my program while only using the stored compiled macro programs in the production environment, a tool to automatically transform all my macros into these stored compiled macro programs would save developers like me a lot of time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mylib 'my_macro_folder';
options mstored sasmstore=mylib;

/*my_macro1.sas file*/
%macro my_macro1() / store source;
 ...
%mend;

/*my_macro2.sas file*/
%macro my_macro2() / store source;
 ...
%mend;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 04:04:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/627747#M185373</guid>
      <dc:creator>jjjch</dc:creator>
      <dc:date>2020-02-27T04:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a tool to transform a lot of macro files to the Stored Compiled Macro program?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/627750#M185376</link>
      <description>&lt;P&gt;You can store macros in any catalog. It doesn't need to be the mstore.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your use case I'd actually would go for a project specific catalog using the technique described &lt;A href="https://go.documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=n1o5fkxq0gqdpcn1xs3ksdks69tf.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;here&lt;/A&gt; under section "&lt;EM&gt;Using SAS Catalogs as Autocall Libraries"&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;You then could simply write a program which scans the folder with the .sas macro code and executes them one by one (just compiling into your project specific catalog).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Scanning the file system to find not yet compiled macros can add a bit of time. The 5 minutes you observe feel very excessive though.&lt;/P&gt;
&lt;P&gt;If there is really no other reason for the difference between first and 2nd run (like cached data, or less data processing due to data already loaded in the first run) then I'd also investigate if there is an I/O or latency issue with the file system where you store your macro code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 04:31:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/627750#M185376</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-02-27T04:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a tool to transform a lot of macro files to the Stored Compiled Macro program?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/627753#M185379</link>
      <description>&lt;P&gt;Hard to tell what your issue is, but it sounds like you are saying that as your program gets larger it take longer to run.&amp;nbsp; Seems normal to me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Storing the compiled macro will not really increase performance (unless you file system is terrible). And it will cause all kinds of maintenance nightmares.&amp;nbsp; But if you did want to do it just run the code that defines the macros.&amp;nbsp; So run once (or when ever the source code changes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mylib 'my_macro_folder';
options mstored sasmstore=mylib;
filename mysource 'my_macro_folder_with_source_code';
%include mysource(*);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then in your real programs you just need the first two lines.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 04:41:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/627753#M185379</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-27T04:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a tool to transform a lot of macro files to the Stored Compiled Macro program?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/627969#M185471</link>
      <description>&lt;P&gt;Hi Patrick, thank you for your reply. Looks like I still need to add " / store " to my macros and compile the macros one by one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I hope there is a real example of "&lt;EM&gt;Using SAS Catalogs as Autocall Libraries"&lt;/EM&gt; in the document to show us how it works.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 16:18:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/627969#M185471</guid>
      <dc:creator>jjjch</dc:creator>
      <dc:date>2020-02-27T16:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a tool to transform a lot of macro files to the Stored Compiled Macro program?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/627971#M185472</link>
      <description>&lt;P&gt;Hi Tom, thank you for your reply. I got the below error for the statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%include mysource(*);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR: Cannot %INCLUDE member (*) in the aggregate MYSOURCE.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%include mysource(my_macro1, my_macro2);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Works though.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 16:34:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/627971#M185472</guid>
      <dc:creator>jjjch</dc:creator>
      <dc:date>2020-02-27T16:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a tool to transform a lot of macro files to the Stored Compiled Macro program?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/627976#M185474</link>
      <description>&lt;P&gt;If it doesn’t work without modifying the code you could also just try running the macro definitions using “normal” settings. That will store the compiled macros in a catalog in WORK library. Normally WORK.SASMACR, but if using EG or SAS/Studio to launch SAS it might be named WORK.SASMAC1 instead.&amp;nbsp; You can then use PROC CATALOG to copy the compiled macros to your permanent catalog.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me state again that normally the compiling of the macro via SASAUTO is NOT a performance issue so trying to convert to using pre-compiled macros will normally not result in any change in performance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 16:33:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/627976#M185474</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-27T16:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a tool to transform a lot of macro files to the Stored Compiled Macro program?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/627985#M185481</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have about 250 macro functions. I want to know how many seconds they need to be compiled. But looks like it is not easy to find out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because I may need to schedule my program to run every 15 minutes or every 10 minutes, and I hope using pre-compiled macros could save me some time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 17:08:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/627985#M185481</guid>
      <dc:creator>jjjch</dc:creator>
      <dc:date>2020-02-27T17:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a tool to transform a lot of macro files to the Stored Compiled Macro program?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/630386#M186624</link>
      <description>&lt;P&gt;By using auto-call system you are simplifying the utilization of the macro, but masking the compilation time with the invocation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are a couple of options to see what auto-call and macro is doing&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;MAUTOCOMPLOC&lt;BR /&gt;MCOMPILENOTE &lt;BR /&gt;MEXECNOTE &lt;BR /&gt;MEXECSIZE&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The compilation time of macros should be static.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The invocation timing is highly variant and dependent on items such as:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Control data affecting code generation&lt;/LI&gt;
&lt;LI&gt;Quality of generated code&lt;/LI&gt;
&lt;LI&gt;Data upon which the code operates&lt;/LI&gt;
&lt;LI&gt;Outputs and reports that the code creates&lt;/LI&gt;
&lt;LI&gt;Operating system factors impacting reading and writing data and ODS
&lt;UL&gt;
&lt;LI&gt;Network share ?&lt;/LI&gt;
&lt;LI&gt;File contention ?&lt;/LI&gt;
&lt;LI&gt;Thread reliance&lt;/LI&gt;
&lt;LI&gt;Inter-OS file sharing ?&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Sat, 07 Mar 2020 17:04:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/630386#M186624</guid>
      <dc:creator>RichardDeVen</dc:creator>
      <dc:date>2020-03-07T17:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a tool to transform a lot of macro files to the Stored Compiled Macro program?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/630413#M186634</link>
      <description>&lt;P&gt;IMO I think you are looking in the wrong place to improve program performance. I use AUTOCALL macros a lot and I've never seen a significant performance hit as it grows. I suggest looking at the IO performance. The fact that your program runs a lot slower first time is indicative of slow IO and data caching could be the reason it speeds up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can easily test the overhead of compiling your macros by %INCLUDEing them first, then timing your program runs after that. If that doesn't change your overall run times then your performance problems are elsewhere.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Mar 2020 21:05:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-tool-to-transform-a-lot-of-macro-files-to-the-Stored/m-p/630413#M186634</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-03-07T21:05:05Z</dc:date>
    </item>
  </channel>
</rss>

