<?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: To semicolon or not to semicolon in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/To-semicolon-or-not-to-semicolon/m-p/60781#M13202</link>
    <description>&lt;P&gt;The semicolon after the macro call will never be used, will it? (actually if it is part of the logic of the macro-generated code, it should be inside the macro itself).&lt;BR /&gt; &lt;BR /&gt; The only reasonable case when a semicolon will be used after the macro call is when it closes a non-macro statement, as in &lt;BR /&gt; title %write_title(big, red, bold);&lt;BR /&gt; but then the semicolon is there to close the title statement, not as part of the macro call.&lt;BR /&gt; &lt;BR /&gt; &amp;gt;I have known programmers who put a semicolon in empty lines as spacers.&lt;BR /&gt; &lt;BR /&gt; Unless you are one of these and like extra and unused semicolons, a semicolon after a macro call makes no sense. &lt;BR /&gt; &lt;BR /&gt; My 2 cents, to each their own and all that. Having an extra ; is not a big sin (though it sometimes hides bad understanding of how macros work).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edited. The deficient&amp;nbsp; color parser is sadly a reason to use an ending semicolon, as it gets confused without this explicit statement delimiter.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Jan 2019 20:13:03 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2019-01-03T20:13:03Z</dc:date>
    <item>
      <title>To semicolon or not to semicolon</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-semicolon-or-not-to-semicolon/m-p/60777#M13198</link>
      <description>We are having a bit of a debate here ... I am an old time SAS programmer who was told that it is better to semicolon after a macro call ... %macroname; There is another thought that one must never semicolon ... %macroname.&lt;BR /&gt;
&lt;BR /&gt;
My thinking is that if there were unbalanced semicolons at least this one would make sure that the macro would run. However, there is a note in a course note publication that states the opposite. I know there are times when if a macro call was in the middle of other code it may not be appropriate. I am just wondering about the call itself as stand alone code.&lt;BR /&gt;
&lt;BR /&gt;
Your thoughts?&lt;BR /&gt;
Thanks!</description>
      <pubDate>Fri, 31 Jul 2009 14:16:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-semicolon-or-not-to-semicolon/m-p/60777#M13198</guid>
      <dc:creator>DJWanna</dc:creator>
      <dc:date>2009-07-31T14:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: To semicolon or not to semicolon</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-semicolon-or-not-to-semicolon/m-p/60778#M13199</link>
      <description>After 25 years, I almost always put in the semicolon.  I have known programmers who put a semicolon in empty lines as spacers.  In most cases it will not hurt, and helps locate things in debugging.&lt;BR /&gt;
&lt;BR /&gt;
I also insist on hard returns and RUN; statements which I often see left out of code.</description>
      <pubDate>Fri, 31 Jul 2009 14:30:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-semicolon-or-not-to-semicolon/m-p/60778#M13199</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-07-31T14:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: To semicolon or not to semicolon</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-semicolon-or-not-to-semicolon/m-p/60779#M13200</link>
      <description>another old $0.02&lt;BR /&gt;
sometimes the statement needs to be completed with a semicolon after the macro is called.&lt;BR /&gt;
The macros which generate steps, usually, finish by generating a semicolon on a "run;"  Those which generate only statements usually deliver statements completed by a semicolon. These macro invocations should not need a trailing semicolon.&lt;BR /&gt;
I use a lot of "sub-statement" macros. They are really useful when a string or value needs to be retrieved. These "sub-statement macros" generate no semicolon so that they can be used, for example, in a calculation. It is normally important that these sub-statement macros are &lt;I&gt;not&lt;/I&gt; immediately followed by a semicolon. &lt;BR /&gt;
For example:&lt;BR /&gt;
%put the message at %now() needs action ;&lt;BR /&gt;
 &lt;BR /&gt;
The semicolon ends the statement, not the macro invocation.&lt;BR /&gt;
  &lt;BR /&gt;
PeterC</description>
      <pubDate>Fri, 31 Jul 2009 15:04:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-semicolon-or-not-to-semicolon/m-p/60779#M13200</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-07-31T15:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: To semicolon or not to semicolon</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-semicolon-or-not-to-semicolon/m-p/60780#M13201</link>
      <description>Agreed.  One really needs to know the context in which a macro is to be used.  In the case of  a sub-statement type of macr. I make it clear in the documentation if no semi-colon is to be used.</description>
      <pubDate>Fri, 31 Jul 2009 15:11:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-semicolon-or-not-to-semicolon/m-p/60780#M13201</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-07-31T15:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: To semicolon or not to semicolon</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-semicolon-or-not-to-semicolon/m-p/60781#M13202</link>
      <description>&lt;P&gt;The semicolon after the macro call will never be used, will it? (actually if it is part of the logic of the macro-generated code, it should be inside the macro itself).&lt;BR /&gt; &lt;BR /&gt; The only reasonable case when a semicolon will be used after the macro call is when it closes a non-macro statement, as in &lt;BR /&gt; title %write_title(big, red, bold);&lt;BR /&gt; but then the semicolon is there to close the title statement, not as part of the macro call.&lt;BR /&gt; &lt;BR /&gt; &amp;gt;I have known programmers who put a semicolon in empty lines as spacers.&lt;BR /&gt; &lt;BR /&gt; Unless you are one of these and like extra and unused semicolons, a semicolon after a macro call makes no sense. &lt;BR /&gt; &lt;BR /&gt; My 2 cents, to each their own and all that. Having an extra ; is not a big sin (though it sometimes hides bad understanding of how macros work).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edited. The deficient&amp;nbsp; color parser is sadly a reason to use an ending semicolon, as it gets confused without this explicit statement delimiter.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 20:13:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-semicolon-or-not-to-semicolon/m-p/60781#M13202</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-01-03T20:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: To semicolon or not to semicolon</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-semicolon-or-not-to-semicolon/m-p/60782#M13203</link>
      <description>Yep, agree with Chris. No need for any semicolon after the macro call.&lt;BR /&gt;
&lt;BR /&gt;
But in my case, sometimes the habit of terminating any line of code with a semicolon takes over this understanding. Indeed, not a big sin.&lt;BR /&gt;
&lt;BR /&gt;
Now, a situation that I found to be particularly confusing to understand for some sas coders is the need of a semicolon after the %if %then macro statement, say something like this:&lt;BR /&gt;
&lt;BR /&gt;
%macro x(TAB,KEEP,VARS);&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
set &amp;amp;TAB %if &amp;amp;KEEP %then (keep = &amp;amp;VARS);;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
/* OR */&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
set &amp;amp;TAB %if &amp;amp;KEEP %then (keep = &amp;amp;VARS); end = _EOF; &lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%mend x;&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos at &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;.</description>
      <pubDate>Mon, 03 Aug 2009 07:40:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-semicolon-or-not-to-semicolon/m-p/60782#M13203</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-08-03T07:40:57Z</dc:date>
    </item>
  </channel>
</rss>

