<?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: How to split or cut overlong SAS program files automatically in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/815109#M321729</link>
    <description>&lt;P&gt;I'm a big fan of AUTOCALL macros so one option would be to split those off into separate program files - one macro per file. If you are going to reorganise your code at all then I'd advise you to do it "properly" and comprehensively otherwise it is not really worth the effort. Splitting by common functionality is my normal approach.&lt;/P&gt;</description>
    <pubDate>Wed, 25 May 2022 20:52:13 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2022-05-25T20:52:13Z</dc:date>
    <item>
      <title>How to split or cut overlong SAS program files automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/814819#M321631</link>
      <description>&lt;P&gt;Hello all,&lt;BR /&gt;Today I am posting here with a rather unusual question.&lt;BR /&gt;I have run into a project that uses overlong SAS programs. Lengths over 10,000 lines are not uncommon (I know there are waaayyy longer programs....). These programs usually consist of functional modules; some of these programs are pure lists of encapsulated macros without a call. My question is: How can such SAS program files (not datasets!!) be automatically split into smaller, more manageable SAS program files? Have you ever done something like this? Using tags?&lt;/P&gt;&lt;P&gt;Looking forward to learn from your experiences!&lt;/P&gt;&lt;P&gt;KC&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 06:47:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/814819#M321631</guid>
      <dc:creator>KidCat</dc:creator>
      <dc:date>2022-05-24T06:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to split or cut overlong SAS program files automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/814820#M321632</link>
      <description>&lt;P&gt;I don't know a tool that can do this and would not trust any tool that promises such miracles.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Each macro should be stored in a separate file named exactly like the macro.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 07:03:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/814820#M321632</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-05-24T07:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to split or cut overlong SAS program files automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/814827#M321634</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;I agree with you.&lt;BR /&gt;However, it doesn't hurt to ask if someone has done this before, ideally using SAS.&lt;/P&gt;&lt;P&gt;It would help to save a lot of manual work.&lt;/P&gt;&lt;P&gt;These "lists" contain dozends of encapsulated macros....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You know I'm thinking of an approach using tags "#" like below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;overlongmacro.sas:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #BEGIN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #NAME&amp;nbsp; part1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #END&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #BEGIN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #NAME&amp;nbsp; part2&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #END&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;split or cut into&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;part1.sas:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #BEGIN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #NAME&amp;nbsp; part1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #END&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;part2.sas:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #BEGIN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #NAME&amp;nbsp; part2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #END&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sounds feasible, but devil's in the details, as per ususal&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 24 May 2022 08:39:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/814827#M321634</guid>
      <dc:creator>KidCat</dc:creator>
      <dc:date>2022-05-24T08:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to split or cut overlong SAS program files automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/814829#M321636</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/318075"&gt;@KidCat&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello all,&lt;BR /&gt;Today I am posting here with a rather unusual question.&lt;BR /&gt;I have run into a project that uses overlong SAS programs. Lengths over 10,000 lines are not uncommon (I know there are waaayyy longer programs....). These programs usually consist of functional modules; some of these programs are pure lists of encapsulated macros without a call. My question is: How can such SAS program files (not datasets!!) be automatically split into smaller, more manageable SAS program files?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why do you want to do this? What is the harm in leaving the files un-split? What is the benefit in splitting SAS code files?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I agree with &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt; , I don't think there is a way to do this other than manually, and I don't see a benefit to doing it manually either. Doing work for no benefit, most people have better things to do.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 10:40:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/814829#M321636</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-05-24T10:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to split or cut overlong SAS program files automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/814863#M321648</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/318075"&gt;@KidCat&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because this is sort-of a "re-design" to create better organized code that's easier to read and maintain, I'd say it's worth putting in the "human" and not just trying to write some code that splits things up.&lt;/P&gt;
&lt;P&gt;If it's a lot of macro definitions then I guess you could write some code that creates a separate file per macro ..../ and matching mend. ..but then you've got all these files so someone would actually also to create some documentation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's also very possible that there are multiple scripts with "copy/pasted" macro definitions so to do some analysis and streamline and document things is highly likely worth the effort and will pay-pack in the moment where you have to investigate an issue, maintain/modify code or migrate - i.e. to SAS Viya as part of platform modernization.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Such effort is of course only worth considering for code that's to stay or that creates critical business results that need to be reproducible and auditable.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 12:31:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/814863#M321648</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-05-24T12:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to split or cut overlong SAS program files automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/814873#M321651</link>
      <description>&lt;P&gt;Here's a list of ideas to consider, to help decide on the right path.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Within a single program, do all your macro definitions appear up front at the beginning of the program?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your macro definitions end with a %mend statement.&amp;nbsp; Do the %mend statements include the name of the macro, or just a semicolon at the end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have macro definitions nested within other macro definitions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If program A and program B both define a macro X, is the definition of %X identical in both programs?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on your answers, here are a couple of alternatives to consider:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Write a SAS program that reads one of your lengthy programs.&amp;nbsp; The goal of that SAS program would be to pull out the macro definitions and write them to the like-named files, creating an autocall library.&lt;/LI&gt;
&lt;LI&gt;Save the macro definitions in one huge, separate file.&amp;nbsp; Then have your current programs %include that separate file instead of hard-coding macro definitions.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;None of this is an ideal solution, and all require some work on your part.&amp;nbsp; But they are possibilities.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 13:39:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/814873#M321651</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-05-24T13:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to split or cut overlong SAS program files automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/815109#M321729</link>
      <description>&lt;P&gt;I'm a big fan of AUTOCALL macros so one option would be to split those off into separate program files - one macro per file. If you are going to reorganise your code at all then I'd advise you to do it "properly" and comprehensively otherwise it is not really worth the effort. Splitting by common functionality is my normal approach.&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 20:52:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/815109#M321729</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-05-25T20:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to split or cut overlong SAS program files automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/815641#M321926</link>
      <description>&lt;P&gt;Indeed this will be a manual job - and it's a great opportunity to consider a standardised framework for organising your SAS project(s).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The one we use at 4GL Apps is described here:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Global-Forum-Proceedings/Scaffolding-SAS-Projects-With-NPM-and-SASjs/ta-p/726347" target="_blank"&gt;https://communities.sas.com/t5/SAS-Global-Forum-Proceedings/Scaffolding-SAS-Projects-With-NPM-and-SASjs/ta-p/726347&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The nice thing about this is you can have the best of both worlds - the project is&amp;nbsp;modular (standalone programs, macros, jobs, services, tests, binary files) and it gets &lt;EM&gt;compiled&lt;/EM&gt; into an 'overlong' SAS program, which is easy to transport / debug / reproduce.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;We regularly run 250k plus programs (mainly due to special-case embedded binary files) and work quickly in the source code where programs are rarely more than a few hundred lines.&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2022 00:47:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/815641#M321926</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2022-05-30T00:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to split or cut overlong SAS program files automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/815649#M321931</link>
      <description>&lt;P&gt;Thank you for recognising the merits of such an approach. Since we first want=need to set tags for documentation, we will also take this opportunity to set tags for "cutting". Whether this "cutting" will be done manually or automatically will be decided in the course of the project. Of course, we want to avoid having to manage two code versions (cut, uncut) for as long as possible.&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2022 07:33:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-split-or-cut-overlong-SAS-program-files-automatically/m-p/815649#M321931</guid>
      <dc:creator>KidCat</dc:creator>
      <dc:date>2022-05-30T07:33:50Z</dc:date>
    </item>
  </channel>
</rss>

