<?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 within do loop in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/do-within-do-loop/m-p/307169#M65752</link>
    <description>Thank you so much for your help</description>
    <pubDate>Tue, 25 Oct 2016 15:47:23 GMT</pubDate>
    <dc:creator>div44</dc:creator>
    <dc:date>2016-10-25T15:47:23Z</dc:date>
    <item>
      <title>do within do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-within-do-loop/m-p/306997#M65711</link>
      <description>&lt;P&gt;data test888;&lt;BR /&gt;set test88;&lt;BR /&gt;array gap(*) gap1-gap370;&lt;BR /&gt;do r=1 to 370;&lt;BR /&gt;do y=1 to 370;&lt;BR /&gt;if ((gap(y) - gap(r)) &amp;gt;= 90) then leave;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot get the code to work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to find the combination of gap(R) and gap(y) which have a difference of more than 89.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 01:09:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-within-do-loop/m-p/306997#M65711</guid>
      <dc:creator>div44</dc:creator>
      <dc:date>2016-10-25T01:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: do within do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-within-do-loop/m-p/307009#M65716</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HAVE;
  array GAP(*) GAP1-GAP370;
  do I=1 to 370;
    GAP[I]=ranuni(0)*100;
  end;
run;

data WANT;
  keep I J VAL_I VAL_J;
  set HAVE;
  array GAP(*) GAP1-GAP370;
  do I=1 to 369;
    do J=I+1 to 370;
      if abs(GAP[I]-GAP[J]) &amp;gt;= 90 then do;
        VAL_I=GAP[I];
        VAL_J=GAP[J];
        output;
      end;
    end;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 02:34:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-within-do-loop/m-p/307009#M65716</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2016-10-25T02:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: do within do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-within-do-loop/m-p/307021#M65721</link>
      <description>&lt;P&gt;Chris has the right idea, changing the limits on your loops. &amp;nbsp;The program will run faster if you don't check the combinations that you don't need to check.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your original program is probably encountering this issue. &amp;nbsp;(I can't test it right now.) &amp;nbsp;The LEAVE statement only applies to a single loop. &amp;nbsp;So it gets you out of the interior loop, without getting you out of the exterior loop. &amp;nbsp;Just take that entire statement and repeat it after the first END statement.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 05:10:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-within-do-loop/m-p/307021#M65721</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-10-25T05:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: do within do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-within-do-loop/m-p/307168#M65751</link>
      <description>Thank you so much for your help !!</description>
      <pubDate>Tue, 25 Oct 2016 15:46:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-within-do-loop/m-p/307168#M65751</guid>
      <dc:creator>div44</dc:creator>
      <dc:date>2016-10-25T15:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: do within do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-within-do-loop/m-p/307169#M65752</link>
      <description>Thank you so much for your help</description>
      <pubDate>Tue, 25 Oct 2016 15:47:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-within-do-loop/m-p/307169#M65752</guid>
      <dc:creator>div44</dc:creator>
      <dc:date>2016-10-25T15:47:23Z</dc:date>
    </item>
  </channel>
</rss>

