<?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 way to match %do and %end in a spaghetti code? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/is-there-a-way-to-match-do-and-end-in-a-spaghetti-code/m-p/500975#M433</link>
    <description>&lt;P&gt;I don't think there is any automated way to do this. You will just have to manually search the code for the %DO-%END blocks, then try to improve readability by indenting the blocks so they easier to spot. You could try Enterprise Guide's code formatter to speed things up but then you will have to put up with EG's formatting rules if they are different to yours.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is a good object lesson for avoiding spaghetti coding.&lt;/P&gt;</description>
    <pubDate>Tue, 02 Oct 2018 21:46:44 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2018-10-02T21:46:44Z</dc:date>
    <item>
      <title>is there a way to match %do and %end in a spaghetti code?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/is-there-a-way-to-match-do-and-end-in-a-spaghetti-code/m-p/500965#M432</link>
      <description>&lt;P&gt;is there a way to match %do and %end in a spaghetti code? I'm lost finding the %end statements for all %do's&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 21:01:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/is-there-a-way-to-match-do-and-end-in-a-spaghetti-code/m-p/500965#M432</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2018-10-02T21:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way to match %do and %end in a spaghetti code?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/is-there-a-way-to-match-do-and-end-in-a-spaghetti-code/m-p/500975#M433</link>
      <description>&lt;P&gt;I don't think there is any automated way to do this. You will just have to manually search the code for the %DO-%END blocks, then try to improve readability by indenting the blocks so they easier to spot. You could try Enterprise Guide's code formatter to speed things up but then you will have to put up with EG's formatting rules if they are different to yours.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is a good object lesson for avoiding spaghetti coding.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 21:46:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/is-there-a-way-to-match-do-and-end-in-a-spaghetti-code/m-p/500975#M433</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-10-02T21:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way to match %do and %end in a spaghetti code?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/is-there-a-way-to-match-do-and-end-in-a-spaghetti-code/m-p/500989#M434</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16600"&gt;@SASPhile&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've just created a keyboard macro (for the SAS Enhanced Editor) which seems to do what you want, but it's rather a risky workaround (with limitations) than a clean solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The major limitation is: Your code must not contain both curly braces {} and square brackets [].&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's assume it doesn't contain curly braces (then it may contain square brackets).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I recorded a keyboard macro (Enhanced Editor: Tools --&amp;gt; Keyboard Macros --&amp;gt; Record New Macro) which&amp;nbsp;replaces &lt;FONT face="courier new,courier"&gt;%do&lt;/FONT&gt; ("Match whole word only") with &lt;FONT face="courier new,courier"&gt;{&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;%end&lt;/FONT&gt; with &lt;FONT face="courier new,courier"&gt;}&lt;/FONT&gt; ("Replace All") and vice versa (so as to restore the original code). Then I stopped recording, edited the macro (&lt;SPAN&gt;Tools --&amp;gt; Keyboard Macros --&amp;gt;&amp;nbsp;Macros... --&amp;gt; Edit...)&amp;nbsp;&lt;/SPAN&gt;to insert the command "Move cursor to matching brace/paren" in the middle between the replacement actions and assigned a shortcut key to the macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, when I place the cursor on the percent sign of a &lt;FONT face="courier new,courier"&gt;%do&lt;/FONT&gt; or &lt;FONT face="courier new,courier"&gt;%end&lt;/FONT&gt; keyword and press the shortcut key, the cursor jumps to the percent sign of the matching &lt;FONT face="courier new,courier"&gt;%end&lt;/FONT&gt; or &lt;FONT face="courier new,courier"&gt;%do&lt;/FONT&gt;, respectively (and back if I press the shortcut key again).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obviously, I haven't tested this macro thoroughly yet and I wouldn't really recommend it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Given&amp;nbsp;that there is an Enhanced Editor command to find matching DO/END pairs in a data step, it's a pity that there is no&amp;nbsp;similar feature&amp;nbsp;for %DO/%END.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 23:00:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/is-there-a-way-to-match-do-and-end-in-a-spaghetti-code/m-p/500989#M434</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-10-02T23:00:25Z</dc:date>
    </item>
  </channel>
</rss>

