<?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: Nested do loop in sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288958#M59643</link>
    <description>Cynthia_sas, can you give an example of later case? Thanks !</description>
    <pubDate>Tue, 02 Aug 2016 15:32:02 GMT</pubDate>
    <dc:creator>SAS_inquisitive</dc:creator>
    <dc:date>2016-08-02T15:32:02Z</dc:date>
    <item>
      <title>Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288751#M59577</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to understand the nested do loop concept. In this example, can we say inner do loop is repeated 2 times ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; do i = 1 to 2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;do j = 1 to 3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 22:57:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288751#M59577</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-08-01T22:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288756#M59582</link>
      <description>&lt;P&gt;No. It's repeated 3 times&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 23:04:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288756#M59582</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-01T23:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288758#M59583</link>
      <description>The inner loop repeats 3 times and the outer 2 times, making 6 iterations in all.</description>
      <pubDate>Mon, 01 Aug 2016 23:05:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288758#M59583</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2016-08-01T23:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288763#M59588</link>
      <description>&lt;P&gt;Also, inner/outer aren't always clear. Is J an inner or outer loop?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
    do i = 1 to 2;
       do j = 1 to 3;
           do k=1 to 5;
                output;
            end;
       end;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Aug 2016 23:18:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288763#M59588</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-01T23:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288765#M59589</link>
      <description>Both &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;...?</description>
      <pubDate>Mon, 01 Aug 2016 23:23:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288765#M59589</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-08-01T23:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288770#M59594</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH﻿&lt;/a&gt;&amp;nbsp;No idea, it probably depends on context. Just that as terminology goes, it's not definitive.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 23:32:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288770#M59594</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-01T23:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288778#M59598</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I agree, it depends on context and how you write the code. I think this comparison of the original do loop example and a modified version with i, j, and k loops in a different position explains how the iterations work -- 30 observations each time (because 2*3*5 or 5*2*3 or 3*2*5 will always equal 30), but the values fall into a different pattern.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/4388iEE57BB8D8AF0444D/image-size/original?v=v2&amp;amp;px=-1" alt="ijk_loop.png" title="ijk_loop.png" border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2016 00:31:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288778#M59598</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-08-02T00:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288782#M59600</link>
      <description>&lt;P&gt;One consideration is worth noting for efficiency purposes ... even though the inner loop executes 30 times in both cases, the total number of loops is different. &amp;nbsp;The left-hand program is the most efficient order and executes a total of 38 loops (2 outer, 6 middle, 30 inner), while the right-hand program executes a total of 45 loops (5 outer, 10 middle, 30 inner). &amp;nbsp;The least efficient order would put the fastest-moving variables on the outside:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;do k=1 to 5;&lt;/P&gt;
&lt;P&gt;do j=1 to 3;&lt;/P&gt;
&lt;P&gt;do i=1 to 2;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now there are a total of 50 loops (5 outer, 15 middle, 30 inner).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2016 01:22:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288782#M59600</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-08-02T01:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288799#M59607</link>
      <description>Hi:&lt;BR /&gt;  Most of the time, I use nested DO loops for data generation. If I am using the DO loops to generate some data for testing, then my primary consideration would be to use the looping syntax that produces the structure I need. Otherwise, I generally find the data structure of data I'm reading will dictate the form of the nested loops.&lt;BR /&gt; &lt;BR /&gt;cynthia</description>
      <pubDate>Tue, 02 Aug 2016 03:13:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288799#M59607</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-08-02T03:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288957#M59642</link>
      <description>Reeza, I mean the entire inner do loop block.</description>
      <pubDate>Tue, 02 Aug 2016 15:30:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288957#M59642</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-08-02T15:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288958#M59643</link>
      <description>Cynthia_sas, can you give an example of later case? Thanks !</description>
      <pubDate>Tue, 02 Aug 2016 15:32:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-sas/m-p/288958#M59643</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-08-02T15:32:02Z</dc:date>
    </item>
  </channel>
</rss>

