<?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 Trouble using the minus sign for counting down a variable in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-using-the-minus-sign-for-counting-down-a-variable/m-p/115996#M9825</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is an embarrasing question, but what exactly is wrong with using the minus sign to count down a variable, such as inside this do-while loop?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;data work.countdown;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;count = -1;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;do while (count NE -100);&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count -1;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;end;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;run;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;proc print data=work.countdown;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It runs perfectly with a plus sign, but once I use the minus sign the count variable turns red and I get this message in the log: "ERROR 180-322: Statement is not valid or it is used out of proper order."&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 08 Sep 2012 19:50:58 GMT</pubDate>
    <dc:creator>TurnTheBacon</dc:creator>
    <dc:date>2012-09-08T19:50:58Z</dc:date>
    <item>
      <title>Trouble using the minus sign for counting down a variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-using-the-minus-sign-for-counting-down-a-variable/m-p/115996#M9825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is an embarrasing question, but what exactly is wrong with using the minus sign to count down a variable, such as inside this do-while loop?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;data work.countdown;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;count = -1;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;do while (count NE -100);&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count -1;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;end;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;run;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;proc print data=work.countdown;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It runs perfectly with a plus sign, but once I use the minus sign the count variable turns red and I get this message in the log: "ERROR 180-322: Statement is not valid or it is used out of proper order."&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Sep 2012 19:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-using-the-minus-sign-for-counting-down-a-variable/m-p/115996#M9825</guid>
      <dc:creator>TurnTheBacon</dc:creator>
      <dc:date>2012-09-08T19:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble using the minus sign for counting down a variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-using-the-minus-sign-for-counting-down-a-variable/m-p/115997#M9826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The count+1 thing is it's own type of statement, it's a SUM STATEMENT.&amp;nbsp; It needs to be a plus sign.&amp;nbsp; There is no equivalent DECREMENT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to do the same (set to 0, retain, use sum function) but decrement, you can do:&lt;/P&gt;&lt;P&gt;count + - 1;&lt;/P&gt;&lt;P&gt;or &lt;/P&gt;&lt;P&gt;count + (-1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;--Q.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Sep 2012 20:32:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-using-the-minus-sign-for-counting-down-a-variable/m-p/115997#M9826</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2012-09-08T20:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble using the minus sign for counting down a variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-using-the-minus-sign-for-counting-down-a-variable/m-p/115998#M9827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, that answers my question very well. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Sep 2012 20:38:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-using-the-minus-sign-for-counting-down-a-variable/m-p/115998#M9827</guid>
      <dc:creator>TurnTheBacon</dc:creator>
      <dc:date>2012-09-08T20:38:46Z</dc:date>
    </item>
  </channel>
</rss>

