<?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: call a macro end with semicolon? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365666#M86878</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;: you said:&amp;nbsp;And I would always put the semi-colon in&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Didn't you really mean to say:&amp;nbsp;And I would always NOT&amp;nbsp;put the semi-colon in&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2017 13:47:44 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2017-06-09T13:47:44Z</dc:date>
    <item>
      <title>call a macro end with semicolon?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365558#M86835</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could anyone tell me what is the difference of add semicolon or not after call a macro?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%put a;&lt;/P&gt;
&lt;P&gt;%mend test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%test;&lt;/P&gt;
&lt;P&gt;%test&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 23:06:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365558#M86835</guid>
      <dc:creator>GeorgeSAS</dc:creator>
      <dc:date>2017-06-08T23:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: call a macro end with semicolon?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365559#M86836</link>
      <description>&lt;P&gt;In your example, it wouldn't make much of a difference .. other than you are typing a character (the semi-colon) that isn't needed. You can find a nice explanation, including cases where it would make a BIG difference, at:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/To-semicolon-or-not-to-semicolon/td-p/60777" target="_blank"&gt;https://communities.sas.com/t5/Base-SAS-Programming/To-semicolon-or-not-to-semicolon/td-p/60777&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 23:29:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365559#M86836</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-06-08T23:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: call a macro end with semicolon?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365560#M86837</link>
      <description>&lt;P&gt;you don't need a semicolon at the end of the above macro because the very last statement (%put a; ) has a semicolon in it, so adding a semicolon to %test; would essentially be the same as typing a;;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 23:33:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365560#M86837</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-06-08T23:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: call a macro end with semicolon?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365570#M86838</link>
      <description>&lt;P&gt;The semicolon is not needed. &amp;nbsp;If you add it, it's like adding a semicolon in the middle of your program. &amp;nbsp;For example, consider:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro test;&lt;/P&gt;
&lt;P&gt;proc print;&lt;/P&gt;
&lt;P&gt;%mend test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%test&amp;nbsp;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%test&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The top macro call generates:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second generates:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The extra semicolon is the one that was added when calling the macro. &amp;nbsp;Most of the time, an extra semicolon won't hurt anything. &amp;nbsp;But here are some cases when it will:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;When the macro call generates just a portion of a SAS statement&lt;/LI&gt;
&lt;LI&gt;When a macro is called repeatedly, and generates an ELSE statement&amp;nbsp;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;In short, adding the semicolon when you call a macro adds the semicolon to the resulting program. &amp;nbsp;Most of the time an extra semicolon is just a null statement and gets ignored. &amp;nbsp;But there are cases when an extra semicolon causes problems.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 01:09:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365570#M86838</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-06-09T01:09:13Z</dc:date>
    </item>
    <item>
      <title>Re: call a macro end with semicolon?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365571#M86839</link>
      <description>&lt;P&gt;Adding a semicolon means you add a semicolon in your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even if&amp;nbsp;unneeded (which is common), it generally won't do any damage [but it could be a problem in the wrong place, for example in&amp;nbsp;something like:&amp;nbsp; &lt;FONT face="courier new,courier"&gt;where VAR1 = %get_value(param) group by VAR2 &lt;/FONT&gt;], but often makes no difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The colour parser in SAS EG and SAS Desktop editors can get confused if the semicolon is missing, and that's reason I usually add it when I can, even if unneeded.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd rather not, but the benefit of better colour parsing outweighs the cost of an extraneous semicolon imho.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 01:39:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365571#M86839</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-06-09T01:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: call a macro end with semicolon?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365619#M86860</link>
      <description>&lt;P&gt;Personally I find this comes under the same heading as the dot at the end of macro varaibles, and the run; at the end of procedures. &amp;nbsp;Are they needed, not all the time, does it make code more readable yes. &amp;nbsp;Therefore I would always finish a macro variable with a dot:&lt;/P&gt;
&lt;P&gt;&amp;amp;macrovariable.&lt;/P&gt;
&lt;P&gt;And I would always put the semi-colon in, and always put run; after each procedure. &amp;nbsp;I don't see any beenfit to not doing this, however there are various downsides, such as coloring in the editor not working, code being less readable, and such like. &amp;nbsp;It also brings up question with people learning when they have seen:&lt;/P&gt;
&lt;P&gt;&amp;amp;macrovariable&lt;/P&gt;
&lt;P&gt;And then think they can get away with it anywhere (this is a question we see here fairly often):&lt;/P&gt;
&lt;P&gt;file="\\abc\&amp;amp;macrovariable.csv";&lt;/P&gt;
&lt;P&gt;Doesn't do what you thing as there is no dot in the resolved text. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are instances where not using the semicolo is valid, for instance if I have a macro that resolves to a result then:&lt;/P&gt;
&lt;P&gt;x=%domymacro(num=5)-20;&lt;/P&gt;
&lt;P&gt;Is fine as the macro resolves say to 100 in this case then 100-20; is fine, but 100;-20; is not.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 08:43:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365619#M86860</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-09T08:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: call a macro end with semicolon?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365666#M86878</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;: you said:&amp;nbsp;And I would always put the semi-colon in&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Didn't you really mean to say:&amp;nbsp;And I would always NOT&amp;nbsp;put the semi-colon in&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 13:47:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365666#M86878</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-06-09T13:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: call a macro end with semicolon?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365679#M86881</link>
      <description>&lt;P&gt;Sorry, I don't follow. &amp;nbsp;I meant that I would always have the code as:&lt;/P&gt;
&lt;P&gt;%macro test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%put a;&lt;/P&gt;
&lt;P&gt;%mend test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the semicolon after the macro invocation, except such times as when the macro is used to resolve to a value, in the case of:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;x=%domymacro(num=5)-20;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This is the only even where I wouldn't have a semicolon as it results in invalid SAS code.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 14:05:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365679#M86881</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-09T14:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: call a macro end with semicolon?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365683#M86884</link>
      <description>&lt;P&gt;With the disclaimer you added .. I agree!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 14:12:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-a-macro-end-with-semicolon/m-p/365683#M86884</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-06-09T14:12:19Z</dc:date>
    </item>
  </channel>
</rss>

