<?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: DO statements missing semicolon in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315352#M68760</link>
    <description>&lt;P&gt;Yes, but in your example ("do&amp;nbsp; if ...."),&amp;nbsp;SAS would send an error message, thereby protecting the programmer from the oversight.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the OP's issue is: if there's no such error message, can there ever be a difference in results attributable to the missing semi-colon?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;M K&lt;/P&gt;</description>
    <pubDate>Tue, 29 Nov 2016 22:00:11 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2016-11-29T22:00:11Z</dc:date>
    <item>
      <title>DO statements missing semicolon</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315339#M68753</link>
      <description>&lt;P&gt;Do statement needs a semicolon as below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DO;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS satement ;&amp;nbsp;&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But recently, I happend to omit the semicolon next to DO statement and it still works and generated the same results as with semicolon.&amp;nbsp;Does that mean that I don't have to worry about the semicolon for DO statement?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for your help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 21:06:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315339#M68753</guid>
      <dc:creator>minitt01</dc:creator>
      <dc:date>2016-11-29T21:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: DO statements missing semicolon</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315340#M68754</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It depends. What kind of code did you have after DO?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can include certain statements after a DO that control the loop.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And others will generate an error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In fact, I'd say it's unusual to see just a DO, it would be something like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if x=1 then do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do i=1, 2, 3 6;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#p1cydk5fq0u4bfn1xfbjt7w1c7lu.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#p1cydk5fq0u4bfn1xfbjt7w1c7lu.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 21:18:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315340#M68754</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-29T21:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: DO statements missing semicolon</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315341#M68755</link>
      <description>&lt;P&gt;I guess what your are really asking is:&amp;nbsp; SAS appears to not object in certain cases when you forget to terminate the DO statement with a semi-colon.&amp;nbsp; And in those cases, if SAS doesn't object, can you be sure the result will be the same as it would&amp;nbsp;be with the semi-colon in place?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know, but I wouldn't trust it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At the moment, I can't think of a counterexample.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For instance these two support the "no difference" conjecture, but that's not proof:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;x=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; y=3*x;&lt;/P&gt;
&lt;P&gt;&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;&amp;nbsp; do&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;x=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; y=3*x;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;regards,&lt;/P&gt;
&lt;P&gt;Mark&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 21:22:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315341#M68755</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2016-11-29T21:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: DO statements missing semicolon</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315346#M68758</link>
      <description>&lt;P&gt;The key to removing the semicolon is that the result has to create a valid DO statement.&amp;nbsp; So if the next statement is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;name='Fred';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That works, because this would be a valid DO loop:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;do name='Fred';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It both sets NAME to "Fred" and performs any additional statements within the loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if the next statement wouldn't form a valid DO statement, you will get an error.&amp;nbsp; A few examples where omitting the semicolon gives you an error because the resulting DO statement is no longer correct syntax:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if name='Fred' then salary='High';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;substr(name, 4,1)='t';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;select (name);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;array names {1} name;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;retain total 0;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 21:37:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315346#M68758</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-11-29T21:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: DO statements missing semicolon</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315352#M68760</link>
      <description>&lt;P&gt;Yes, but in your example ("do&amp;nbsp; if ...."),&amp;nbsp;SAS would send an error message, thereby protecting the programmer from the oversight.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the OP's issue is: if there's no such error message, can there ever be a difference in results attributable to the missing semi-colon?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;M K&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 22:00:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315352#M68760</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2016-11-29T22:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: DO statements missing semicolon</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315380#M68774</link>
      <description>&lt;P&gt;Well, I had a chance to think about this on the ride home. &amp;nbsp;If that's the question, I think you're right. &amp;nbsp;The closest I could imagine was this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data testing;&lt;/P&gt;
&lt;P&gt;before = time();&lt;/P&gt;
&lt;P&gt;do i=1 to 10000000;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;do after = time();&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;end;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;diff = after - before;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Compare that with the added semicolon:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data testing2;&lt;/P&gt;
&lt;P&gt;before = time();&lt;/P&gt;
&lt;P&gt;do i=1 to 10000000;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;after = time();&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;end;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;diff = after - before;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now if for some reason the programs differ in their execution time, DIFF would change. &amp;nbsp;Even so, that's a lot of imagination with zero practicality.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 00:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315380#M68774</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-11-30T00:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: DO statements missing semicolon</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315526#M68849</link>
      <description>&lt;P&gt;Thank you for your opinion.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, it was in IF/THEN statement. I was expecting an error message but there was not. That's why I was confused.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me try it with some other data and see how it works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again,&amp;nbsp;&lt;/P&gt;&lt;P&gt;MJ&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 14:19:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315526#M68849</guid>
      <dc:creator>minitt01</dc:creator>
      <dc:date>2016-11-30T14:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: DO statements missing semicolon</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315528#M68850</link>
      <description>&lt;P&gt;Thank you for your attention on this topic.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, I was confused cuz it didn't give me any error message and generated the same result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know why this still works.. need to search more.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again,&amp;nbsp;&lt;/P&gt;&lt;P&gt;MJ&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 14:22:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315528#M68850</guid>
      <dc:creator>minitt01</dc:creator>
      <dc:date>2016-11-30T14:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: DO statements missing semicolon</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315537#M68855</link>
      <description>&lt;P&gt;Thank you for your opinion.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes I expected an error message but it runs without error message.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought that SAS code is very sensitive on Semicolon and operators.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to search little more detail about this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again,&amp;nbsp;&lt;/P&gt;&lt;P&gt;MJ&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 14:45:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-statements-missing-semicolon/m-p/315537#M68855</guid>
      <dc:creator>minitt01</dc:creator>
      <dc:date>2016-11-30T14:45:09Z</dc:date>
    </item>
  </channel>
</rss>

