<?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: Nesting and / or Overlapping DO LOOP Structures in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Nesting-and-or-Overlapping-DO-LOOP-Structures-in-SAS/m-p/283226#M57701</link>
    <description>&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is what I expected but I wanted to be sure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does the same approach apply to DATA Steps and SAS Procedures with respect to RUN Statements?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have seen some SAS code where&amp;nbsp;&lt;SPAN&gt;DATA Steps and SAS Procedures are not executed sequentially &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;by their own corresponding RUN statements and they are not nested but seem to overlap.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 10 Jul 2016 21:03:31 GMT</pubDate>
    <dc:creator>JonDickens1607</dc:creator>
    <dc:date>2016-07-10T21:03:31Z</dc:date>
    <item>
      <title>Nesting and / or Overlapping DO LOOP Structures in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nesting-and-or-Overlapping-DO-LOOP-Structures-in-SAS/m-p/283207#M57690</link>
      <description>&lt;P&gt;Question:&lt;/P&gt;&lt;P&gt;When using two or more Do Loops should they always be NESTED or can they OVERLAP?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DO /* Start of Do Loop One */&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SAS Statements for Loop One ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; DO /* Start of Do Loop Two */&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SAS Statements for Loop Two ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; END ; /* End of Do Loop Two */&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; More SAS Statements for Loop One ;&lt;BR /&gt;END ; /* End of Do Loop One */&lt;/P&gt;&lt;P&gt;/*******************************************************************************/&lt;BR /&gt;DO /* Start of Do Loop One */&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;SAS Statements for Loop One ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;DO /* Start of Do Loop Two */&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SAS Statements for Loop Two ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;SAS Statements for Loop One ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;END ; /* End of Do Loop One */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; More SAS Statements for Loop Two ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; END ; /* End of Do Loop Two */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If it is legal to overlap Do Loop structures, when would you need to do so?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jul 2016 11:54:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nesting-and-or-Overlapping-DO-LOOP-Structures-in-SAS/m-p/283207#M57690</guid>
      <dc:creator>JonDickens1607</dc:creator>
      <dc:date>2016-07-10T11:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: Nesting and / or Overlapping DO LOOP Structures in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nesting-and-or-Overlapping-DO-LOOP-Structures-in-SAS/m-p/283208#M57691</link>
      <description>&lt;P&gt;See the BOLD comments made in the body of your code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DO /* Start of Do Loop One */&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SAS Statements for Loop One ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; DO /* Start of Do Loop Two */&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SAS Statements for Loop Two ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; END ; /* End of Do Loop Two */&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; More SAS Statements for Loop One ;&lt;BR /&gt;END ; /* End of Do Loop One */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;** &amp;nbsp;The above do-loops are the customary DO-LOOPS. They are efficient in terms computing time. &amp;nbsp; ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;** &amp;nbsp;No repeated computations are &amp;nbsp;done;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;/*******************************************************************************/&lt;BR /&gt;DO /* Start of Do Loop One */&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;SAS Statements for Loop One ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;DO /* Start of Do Loop Two */&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SAS Statements for Loop Two ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;SAS Statements for Loop One ;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;** The above statement is repeated as many times as the Do Loop Two, while unchanging the computed&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;value as would have done with Loop One. ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;** &amp;nbsp;But, if this statement involves VARIABLES from Do Loop Two, then the computed value will change&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;for every iteration of the Do Loop Two. In this case, it is necessary and efficient. ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;END ; /* End of Do Loop One */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; More SAS Statements for Loop Two ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; END ; /* End of Do Loop Two */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jul 2016 12:36:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nesting-and-or-Overlapping-DO-LOOP-Structures-in-SAS/m-p/283208#M57691</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2016-07-10T12:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Nesting and / or Overlapping DO LOOP Structures in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nesting-and-or-Overlapping-DO-LOOP-Structures-in-SAS/m-p/283212#M57693</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/85559"&gt;@JonDickens1607&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Question:&lt;/P&gt;
&lt;P&gt;When using two or more Do Loops should they always be NESTED or can they OVERLAP?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That's a clear yes. If only because SAS has no way of knowing you ment to end an outer loop rather than the current innermost DO with&amp;nbsp;your END statement. I think it also raises some logical issues as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;- Jan.&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>Sun, 10 Jul 2016 15:03:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nesting-and-or-Overlapping-DO-LOOP-Structures-in-SAS/m-p/283212#M57693</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2016-07-10T15:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Nesting and / or Overlapping DO LOOP Structures in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nesting-and-or-Overlapping-DO-LOOP-Structures-in-SAS/m-p/283214#M57695</link>
      <description>&lt;P&gt;The top form of your program is the one that SAS will execute. &amp;nbsp;SAS would never interpret your statements in a way that executes the bottom form.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the rule (assuming you don't have any SELECT groups which also end with an END statement). &amp;nbsp;When SAS encounters an END statement, which DO does it match up with? &amp;nbsp;100% of the time, it matches the most recent not-yet-ended DO statement.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jul 2016 15:33:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nesting-and-or-Overlapping-DO-LOOP-Structures-in-SAS/m-p/283214#M57695</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-07-10T15:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Nesting and / or Overlapping DO LOOP Structures in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nesting-and-or-Overlapping-DO-LOOP-Structures-in-SAS/m-p/283226#M57701</link>
      <description>&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is what I expected but I wanted to be sure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does the same approach apply to DATA Steps and SAS Procedures with respect to RUN Statements?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have seen some SAS code where&amp;nbsp;&lt;SPAN&gt;DATA Steps and SAS Procedures are not executed sequentially &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;by their own corresponding RUN statements and they are not nested but seem to overlap.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jul 2016 21:03:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nesting-and-or-Overlapping-DO-LOOP-Structures-in-SAS/m-p/283226#M57701</guid>
      <dc:creator>JonDickens1607</dc:creator>
      <dc:date>2016-07-10T21:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: Nesting and / or Overlapping DO LOOP Structures in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nesting-and-or-Overlapping-DO-LOOP-Structures-in-SAS/m-p/283228#M57702</link>
      <description>&lt;P&gt;Each DATA and PROC step runs independently of every other step. &amp;nbsp;There is no overlap.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are a handful of cases that might look slightly different. &amp;nbsp;Some procedures don't end with a RUN statement. &amp;nbsp;There can be several groups of statements (each with their own RUN statement) as part of the same procedure. &amp;nbsp;They are not nested, however. &amp;nbsp;The entire procedure would end with a QUIT statement in that case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Within a DATA step, CALL EXECUTE can make additional SAS statements part of the program. &amp;nbsp;Any DATA and PROC steps generated in this way do not execute until the current DATA step finishes, however.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, by leaving out a RUN statement, you can get a step to run later, when SAS sees the next DATA or PROC step beginning. &amp;nbsp;But the steps still run sequentially.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jul 2016 22:14:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nesting-and-or-Overlapping-DO-LOOP-Structures-in-SAS/m-p/283228#M57702</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-07-10T22:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: Nesting and / or Overlapping DO LOOP Structures in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nesting-and-or-Overlapping-DO-LOOP-Structures-in-SAS/m-p/283230#M57703</link>
      <description>yes, I think the last example would probably be close to what I saw and I&lt;BR /&gt;wanted to add a run statement but it made it look as if the two code&lt;BR /&gt;segments were overlapping.&lt;BR /&gt;&lt;BR /&gt;##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##</description>
      <pubDate>Sun, 10 Jul 2016 22:53:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nesting-and-or-Overlapping-DO-LOOP-Structures-in-SAS/m-p/283230#M57703</guid>
      <dc:creator>JonDickens1607</dc:creator>
      <dc:date>2016-07-10T22:53:56Z</dc:date>
    </item>
  </channel>
</rss>

