<?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: Approach to long and complex SAS coding in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396546#M278169</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/24798"&gt;@ammarhm&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;I normally try to break up the problem into logical units and to implement these as self contained SAS programs.&lt;/P&gt;
&lt;P&gt;This allow to test each program individually as well as to run the whole project either via a master.sas or even better via a scheduler which then also allows for parallel run of programs with full control over job dependencies.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Sep 2017 07:01:08 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2017-09-16T07:01:08Z</dc:date>
    <item>
      <title>Approach to long and complex SAS coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396538#M278165</link>
      <description>&lt;P&gt;I have a question regarding your approach to complex project / long SAS code files.&lt;/P&gt;
&lt;P&gt;One problem that I frequently encountre with long SAS projects, is that the code becomes so long that it becomes difficult to come back at a later stage and just jumt into a specific pasrt and debug it or change it...&lt;/P&gt;
&lt;P&gt;Commenting the code is something that I always use, but still, this becomes impractical when the code is very long...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wish that SAS could add the option of&amp;nbsp; Bookmarks into the code so that it would easier to find the part I want to go to and debug from there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HOWEVER, my approach now is to split the code, so I have one file that prepares the main dataset, and then several other .sas files with code that basically built from the main dataset to give a specific part of the solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is not a straight forward solution as you can imaging, my question to you is: Is there a code/way to excute the code in a .sas file from another .sas file&lt;/P&gt;
&lt;P&gt;What I am trying to do is something somilar to %include but that would excute standard sas code rather than a Macro code.&lt;/P&gt;
&lt;P&gt;So here is what I want to do&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;some code to excuse data.sas which prepares the main dataset
.
.
.
.
code here to process the data generates
..
.
.
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am also interested to hear what you do or if you have a different approach to long/ complex sas code files&lt;/P&gt;
&lt;P&gt;Thnak you&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 03:55:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396538#M278165</guid>
      <dc:creator>ammarhm</dc:creator>
      <dc:date>2017-09-16T03:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: Approach to long and complex SAS coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396539#M278166</link>
      <description>&lt;P&gt;%INCLUDE() runs whatever code is included, whether it's SAS code, formats, functions or macros.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I typically use the approach there but my code is organized into sections based on project.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Formats &amp;amp; Functions each go into their own file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macros - it depends, depending on the type will either be their own file or multiple in one. If it's very project specific, they'll be in one, if they're more generic they're in a single unique file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This approach allows me to re-use macros/formats/functions easily.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I then break my main programs into:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data Import&lt;/P&gt;
&lt;P&gt;Data Prep/Cleaning&lt;/P&gt;
&lt;P&gt;Data Analysis&lt;/P&gt;
&lt;P&gt;Reporting &amp;amp; Graphs&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 04:02:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396539#M278166</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-16T04:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: Approach to long and complex SAS coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396540#M278167</link>
      <description>Oh...an there's a main 'control program' that drives the whole process.</description>
      <pubDate>Sat, 16 Sep 2017 04:02:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396540#M278167</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-16T04:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Approach to long and complex SAS coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396542#M278168</link>
      <description>&lt;P&gt;I concur with what Reeza said about breaking it up with some of my own caveats.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%include works for anything: don't think of it as macro coding because it isn't (despite the % in front).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For complex coding, I prefer to use %include and data step vs macro. Why? Easier to debug. An example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_ ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;file someTempFile ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;put 'data test;'&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/ 'set sashelp.class;'&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;etc.&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%include someTempFile ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you get is standalone sas programs that can be tested in isolation vs macro stuff. When macro gets really complex, it is very hard to debug. Using the put staments, you achieve the same processing cost but at leat you can see what is happening.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Split it, isolate it, make it something you can easily decipher and test.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, adopt documentation standards. See an example on sasCommunity called SaviDoc. File link is gone (I can send you it) but the standards are listed. If you follow them, you can create your own bookmarks by merely parsing your SAS&amp;nbsp;code. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 04:37:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396542#M278168</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2017-09-16T04:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: Approach to long and complex SAS coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396546#M278169</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/24798"&gt;@ammarhm&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;I normally try to break up the problem into logical units and to implement these as self contained SAS programs.&lt;/P&gt;
&lt;P&gt;This allow to test each program individually as well as to run the whole project either via a master.sas or even better via a scheduler which then also allows for parallel run of programs with full control over job dependencies.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 07:01:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396546#M278169</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-09-16T07:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Approach to long and complex SAS coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396547#M278170</link>
      <description>&lt;P&gt;Thank you everyone for the responses which are highly appreciated.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;could you please elaborate on using a "scheduler" ? I am interested in knowing how you use this&lt;BR /&gt;Kind regards&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 07:23:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396547#M278170</guid>
      <dc:creator>ammarhm</dc:creator>
      <dc:date>2017-09-16T07:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: Approach to long and complex SAS coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396550#M278171</link>
      <description>&lt;P&gt;Here is a useful link that describes the various ways SAS jobs can be scheduled. It is a very large topic so don't be put off by this. Scheduling is an essential part of any SAS Production environment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/scheduleug/68697/HTML/default/viewer.htm#n1av1t0k29q1rfn1r9cl5bg4dftb.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/scheduleug/68697/HTML/default/viewer.htm#n1av1t0k29q1rfn1r9cl5bg4dftb.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also for managing large and complex SAS applications, using version control tools is also very helpful as you can compare changes made between program versions and easily follow the complete history of your code development.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 08:11:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396550#M278171</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2017-09-16T08:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: Approach to long and complex SAS coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396554#M278172</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Thank you for the reply&lt;/P&gt;
&lt;P&gt;What version control tools do you use / recommend please?&lt;/P&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 08:29:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396554#M278172</guid>
      <dc:creator>ammarhm</dc:creator>
      <dc:date>2017-09-16T08:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: Approach to long and complex SAS coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396565#M278173</link>
      <description>&lt;P&gt;Use Git. I wouldn't even bother with others (or even looking at alternatives) unless you are required to use something else.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Git is also integrated with EG so that helps a lot as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 12:50:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396565#M278173</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2017-09-16T12:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Approach to long and complex SAS coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396569#M278174</link>
      <description>&lt;P&gt;You might find this thread on Git helpful&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SASware-Ballot-Ideas/enable-non-local-git-server-integration/idi-p/312736" target="_blank"&gt;https://communities.sas.com/t5/SASware-Ballot-Ideas/enable-non-local-git-server-integration/idi-p/312736&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 14:06:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396569#M278174</guid>
      <dc:creator>MichelleHomes</dc:creator>
      <dc:date>2017-09-16T14:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Approach to long and complex SAS coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396575#M278175</link>
      <description>&lt;P&gt;Modular programming is definitely a big help to keeping things organized.&amp;nbsp; You can use %INCLUDE statement for modules (as others have pointed out, it's not related at all to the macro langauge), or macros.&amp;nbsp; I tend to use macros for modularization, because the definition I learned for a macro was "a parameterized unit of code."&amp;nbsp; That ability to pass parameters makes it easier to develop, test, and re-use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ed Healton has a nice paper on an approach to top-down structured programming using macros:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.lexjansen.com/nesug/nesug01/at/at1010.pdf" target="_blank"&gt;http://www.lexjansen.com/nesug/nesug01/at/at1010.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you do it well, you can end up with a nice high-level outline of macro calls, which make it easier to understand the structure / flow of the of the code wiout stating at pages of code.&amp;nbsp; Ed mentioned to me at one point that his rule was "if you can't read the whole module in a single screen, consider splitting it into multiple modules."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you might end up with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%setup()&lt;/P&gt;
&lt;P&gt;%ReadData(file=)&lt;/P&gt;
&lt;P&gt;%AnalyzeData(...)&lt;/P&gt;
&lt;P&gt;%EmailResults(..)&lt;/P&gt;
&lt;P&gt;%CheckLog(...)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And of course each module above would have sub-modules.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In Enterprise Guide,&amp;nbsp;you can use the process flow view to visually arrange the modules (where each module is a linked&amp;nbsp;.sas file storing a single macro definition).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't always use this approach to the extreme, but it's handy to keep in mind for complex problems. And when I use it, I rarely regret it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;--Q.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 16:20:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396575#M278175</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2017-09-16T16:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: Approach to long and complex SAS coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396584#M278176</link>
      <description>I use macros the same but I try not to venture too deep behind simple call&lt;BR /&gt;and parm substitution.&lt;BR /&gt;</description>
      <pubDate>Sat, 16 Sep 2017 19:05:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396584#M278176</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2017-09-16T19:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: Approach to long and complex SAS coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396599#M278177</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/24798"&gt;@ammarhm&lt;/a&gt;&amp;nbsp;- Regarding version control tools - I always recommend checking out those that are already used in your organisation. Perhaps there is already a preferred enterprise tool that is already setup and all you have to do is start using it. That is the case where I currently work. It just so happens that the tool is Microsoft Visual Studio with MS Team Foundation Server. It works really well with SAS programs and integrates nicely with SAS Enterprise Guide.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am sure there are many other VC tools that work equally as well but using an existing tool in your company is just so much easier.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 22:40:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396599#M278177</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2017-09-16T22:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: Approach to long and complex SAS coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396612#M278178</link>
      <description>&lt;P&gt;Thank you everyone for the suggestions and useful answeres&lt;/P&gt;</description>
      <pubDate>Sun, 17 Sep 2017 01:41:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/396612#M278178</guid>
      <dc:creator>ammarhm</dc:creator>
      <dc:date>2017-09-17T01:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: Approach to long and complex SAS coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/402496#M278179</link>
      <description>We have to use Subversion for version control... very much overkill for what we need to do. I use UltraEdit. It automatically makes a backup copy identified by a version number each time you save.</description>
      <pubDate>Mon, 09 Oct 2017 20:02:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/402496#M278179</guid>
      <dc:creator>bentleyj1</dc:creator>
      <dc:date>2017-10-09T20:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: Approach to long and complex SAS coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/404041#M278180</link>
      <description>&lt;P&gt;I too use the approach of organizing my programs by import -&amp;gt; coding -&amp;gt; reports -&amp;gt; stats -&amp;gt; graphs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To organize, each section and subsection starts with a comment with two asterisks in outline format. Example:&lt;/P&gt;&lt;P&gt;** 1.0 Import source data;&lt;/P&gt;&lt;P&gt;** 1.1 Import Questionnaires;&lt;/P&gt;&lt;P&gt;** 1.2 Import Labs;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;** 2.0 Recode and transform data;&lt;/P&gt;&lt;P&gt;** 2.1 Collapse categories;&lt;/P&gt;&lt;P&gt;** 2.2 Normalize skewed distributions;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then have a separate program that takes the name of a SAS program as it's input and then prints out the program outline as defined by the text following the double-asterisks. This is simple text parsing, but produces a document that provides a road map to the entire program.&amp;nbsp; It doesn't help with the problem of running specific sections of code. But helps a when you need to understand a program you wrote a long time ago.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...don&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro pgmdoc(fn);&lt;BR /&gt;filename pgmfile "&amp;amp;fn";&lt;BR /&gt;&lt;BR /&gt;data _pgmdoctemp_;&lt;BR /&gt;attrib Outline length=$255 format=$145.;&lt;BR /&gt;infile pgmfile linesize=255;&lt;BR /&gt;input Outline &amp;amp;;&lt;BR /&gt;&lt;BR /&gt;if scan(upcase(Outline),1) ='DATA' then do;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Outline='&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '||trim(Outline); output; end; else&lt;BR /&gt;if scan(upcase(Outline),1) ='PROC' then do;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Outline='&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '||trim(Outline); output; end; else&lt;BR /&gt;if scan(upcase(Outline),1) ='SET' then do;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Outline='&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '||trim(Outline); output; end; else&lt;BR /&gt;if scan(upcase(Outline),1) ='MERGE' then do;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Outline='&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '||trim(Outline); output; end; else&lt;BR /&gt;if scan(upcase(Outline),1) ='LIBNAME' then do; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Outline='&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '||trim(Outline); output; end; else&lt;BR /&gt;if substr(upcase(Outline),1,4)='%LET' then do;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Outline='&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '||substr(Outline,1,length(outline)); output; end; else&lt;BR /&gt;if substr(upcase(Outline),1,8)='%INCLUDE' then do;&amp;nbsp; Outline='&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '||substr(Outline,1,length(outline)); output; end; else&lt;BR /&gt;if substr(Outline,1,3)='** ' then do;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Outline=trim(substr(Outline,4,length(Outline)));output; end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;title 'SAS Program Documenter';&lt;BR /&gt;title2 "&amp;amp;fn";&lt;BR /&gt;proc print data=_pgmdoctemp_ noobs;&lt;BR /&gt;var Outline;&lt;BR /&gt;run;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 17:20:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/404041#M278180</guid>
      <dc:creator>don_mcmahon</dc:creator>
      <dc:date>2017-10-13T17:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: Approach to long and complex SAS coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/404079#M278181</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/171537"&gt;@don_mcmahon&lt;/a&gt;&amp;nbsp;You may want to take a look at PROC SCAPROC if you aren't already familiar with it.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 19:16:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/404079#M278181</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-13T19:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Approach to long and complex SAS coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/415505#M278182</link>
      <description>&lt;P&gt;I use most of the methods mentioned by other contributors plus a few others.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Break code into cohesive sections.&lt;/P&gt;&lt;P&gt;Make the sections have as low a coupling as possible.&lt;/P&gt;&lt;P&gt;Use macro variables to parameterise code. There is a downside: too many global variables (= coupling).&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Save code as "modules" and %include them as needed.&lt;/P&gt;&lt;P&gt;Write pre- and post- assertions for each module formally to define what it does.&lt;/P&gt;&lt;P&gt;Include the unit test code with every module commented out at the end.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;I write the documentation in the code marked with special comment symbols of /** or **; A simple awk script then processes these into html in a similar way to javadoc.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Replace as much DATA&amp;nbsp;step merge code with PROC SQL as possible. It makes the code shorter and easier to read.&lt;/P&gt;&lt;P&gt;Use data-driven methods as much as possible. This tends to make things simpler, shorter, more reliable and easier to test. SQL helps here.&lt;/P&gt;&lt;P&gt;Replace macro logic with DATA step logic and data-driven methods. DATA step logic is far easier to debug and quoting is not a problem.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;To make your code easier to read change the editor to show a light grey background to comments. The colour extends to the screen width. Then use comments to break up sections of code. You will be surprised how big a difference it makes.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 13:40:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Approach-to-long-and-complex-SAS-coding/m-p/415505#M278182</guid>
      <dc:creator>Peter_L</dc:creator>
      <dc:date>2017-11-22T13:40:01Z</dc:date>
    </item>
  </channel>
</rss>

