<?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: Please make me understand what is the use of do while in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Please-make-me-understand-what-is-the-use-of-do-while/m-p/875822#M346064</link>
    <description>&lt;P&gt;You can read about WHILE() in a DO statement in the documentation.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/p1awxgleif5wlen1pja0nrn6yi6i.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/p1awxgleif5wlen1pja0nrn6yi6i.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would ignore that example program.&amp;nbsp; It does not appear to be doing anything of value.&amp;nbsp; It appears to have been created with the express purpose of confusing the reader.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look at the examples in the documentation instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 15 May 2023 14:11:16 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-05-15T14:11:16Z</dc:date>
    <item>
      <title>Please make me understand what is the use of do while</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-make-me-understand-what-is-the-use-of-do-while/m-p/875819#M346062</link>
      <description>&lt;P&gt;Hi Everyone, I am learning SAS from carpenters guide. there I found this. this is one of the ways to do a table look up. But I dint understand the use of Do while. Can some one explain&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data one;&lt;BR /&gt;input id sex $;&lt;BR /&gt;datalines;&lt;BR /&gt;10 F&lt;BR /&gt;12 M&lt;BR /&gt;13 M&lt;BR /&gt;14 F&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data = one;&lt;BR /&gt;by sex;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data = two;&lt;BR /&gt;by sex;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data two;&lt;BR /&gt;input sex $ class $;&lt;BR /&gt;datalines;&lt;BR /&gt;M eng&lt;BR /&gt;F Soc&lt;BR /&gt;L mat&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data withnames(keep= sex class ID);&lt;BR /&gt;set one (rename=(sex=Gender));&lt;BR /&gt;if Gender=Sex then output;&lt;BR /&gt;do while(Gender&amp;gt;Sex);&lt;BR /&gt;set two(keep=sex class);&lt;BR /&gt;if Gender=Sex then output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 14:03:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-make-me-understand-what-is-the-use-of-do-while/m-p/875819#M346062</guid>
      <dc:creator>nxmogil</dc:creator>
      <dc:date>2023-05-15T14:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: Please make me understand what is the use of do while</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-make-me-understand-what-is-the-use-of-do-while/m-p/875822#M346064</link>
      <description>&lt;P&gt;You can read about WHILE() in a DO statement in the documentation.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/p1awxgleif5wlen1pja0nrn6yi6i.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/p1awxgleif5wlen1pja0nrn6yi6i.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would ignore that example program.&amp;nbsp; It does not appear to be doing anything of value.&amp;nbsp; It appears to have been created with the express purpose of confusing the reader.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look at the examples in the documentation instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 14:11:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-make-me-understand-what-is-the-use-of-do-while/m-p/875822#M346064</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-05-15T14:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Please make me understand what is the use of do while</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-make-me-understand-what-is-the-use-of-do-while/m-p/875842#M346070</link>
      <description>&lt;P&gt;Is your question about doing the table look up or the actual Do While?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Do While" repeats a block of code until a condition changes.&lt;/P&gt;
&lt;P&gt;"Do Until" repeats a block of code until a condition is met.&lt;/P&gt;
&lt;P&gt;Closely related. Generally there is something inside the block of code controlled by the loop that updates or sets the value(s) used in the condition(s) in Do While/Until statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Caution: These two statements are likely the cause of most infinite loops as a poorly stated condition, or not changing the values used in the conditions correctly, means the end condition is never met.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Strongly suggest testing such code with very small data sets with known values so the expected loop behavior should have small run times. If the set doesn't finish in a short time you are likely in an infinite loop and have to interrupt the running code. Hint: SAVE the code before running. You may end up finding it easier to end the SAS process than to just interrupt the code depending on your set up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do While, Do Until and Do loops in general are common programming structures and not just SAS but many other language references of such apply. The difference is typically how the conditions are specified. This means you can find lots of examples if not limiting to just SAS.&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 15:42:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-make-me-understand-what-is-the-use-of-do-while/m-p/875842#M346070</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-05-15T15:42:52Z</dc:date>
    </item>
  </channel>
</rss>

