<?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: iterative values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/iterative-values/m-p/148577#M29375</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Divide by 100, then round upwards to the next integer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;batch=ceil(var1/100);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Mar 2014 12:14:59 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2014-03-19T12:14:59Z</dc:date>
    <item>
      <title>iterative values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/iterative-values/m-p/148576#M29374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an input dataset, an example of which looks like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have; &lt;/P&gt;&lt;P&gt;input var1;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;45&lt;/P&gt;&lt;P&gt;100&lt;/P&gt;&lt;P&gt;101&lt;/P&gt;&lt;P&gt;145&lt;/P&gt;&lt;P&gt;200&lt;/P&gt;&lt;P&gt;201&lt;/P&gt;&lt;P&gt;256&lt;/P&gt;&lt;P&gt;345&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create another variable (say, Batch) based on the criteria: if var1=1 to 100 then Batch=1, var1=101 to 200 then Batch=2, etc.&lt;/P&gt;&lt;P&gt;For this dataset, I can do this using this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data out; set&amp;nbsp; have;&lt;/P&gt;&lt;P&gt;if var1&amp;lt;=100 then batch=1;&lt;/P&gt;&lt;P&gt;else if var1&amp;lt;=200 then batch=2;&lt;/P&gt;&lt;P&gt;else if var1&amp;lt;=300 then batch=3;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if the actual values of var1 get bigger (say 3040) that would involve writing too many else if's. Also, the values of var1 could go up or down, so will not know in advance how many else if statements I would need. Once I determine the maximum value of var1 (say, MaxVar1), please could you suggest how to calculate the variable Batch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks.&lt;/P&gt;&lt;P&gt;VD &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2014 12:11:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/iterative-values/m-p/148576#M29374</guid>
      <dc:creator>VD</dc:creator>
      <dc:date>2014-03-19T12:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: iterative values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/iterative-values/m-p/148577#M29375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Divide by 100, then round upwards to the next integer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;batch=ceil(var1/100);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2014 12:14:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/iterative-values/m-p/148577#M29375</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2014-03-19T12:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: iterative values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/iterative-values/m-p/148578#M29376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2014 12:20:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/iterative-values/m-p/148578#M29376</guid>
      <dc:creator>VD</dc:creator>
      <dc:date>2014-03-19T12:20:32Z</dc:date>
    </item>
  </channel>
</rss>

