<?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: Best way to repeat the same steps over and over until a value is reached? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Best-way-to-repeat-the-same-steps-over-and-over-until-a-value-is/m-p/300369#M63429</link>
    <description>&lt;P&gt;I did end up getting this to work with a do/until and built in counter, but the code is too long to post here.&amp;nbsp; If someone wants to send me a message with a question, feel free.&amp;nbsp; But i don't know how to delete posts, so i'm going to use this one as the solution. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 23 Sep 2016 13:29:16 GMT</pubDate>
    <dc:creator>MeganE</dc:creator>
    <dc:date>2016-09-23T13:29:16Z</dc:date>
    <item>
      <title>Best way to repeat the same steps over and over until a value is reached?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-way-to-repeat-the-same-steps-over-and-over-until-a-value-is/m-p/299339#M63091</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have four-ish SAS steps that i want to repeat until no more records are deleted in the last step.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I was thinking do/until sounded right, but i have never used it before, so i wasn't sure.&amp;nbsp; So keep in mind, while i'm playing around with writing stuff, nothing is currently running.&amp;nbsp; This is pretty much abstract theory so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But i was thinking:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro&lt;/P&gt;&lt;P&gt;%do %until (var=0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; blah - frequency&lt;/P&gt;&lt;P&gt;&amp;nbsp; blah - second separate data step&lt;/P&gt;&lt;P&gt;&amp;nbsp; blah - third separate data step&lt;/P&gt;&lt;P&gt;&amp;nbsp; blah - other data step&lt;/P&gt;&lt;P&gt;&amp;nbsp; blah - check dictionary tables for record counts&lt;/P&gt;&lt;P&gt;&amp;nbsp; var=[record counts]-[record counts]&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So in step 5, it was grabbing the nobs from the dictionary tables, so could tell whether any records were deleted in step 4, and have a tangible count of it.&amp;nbsp; If no records were deleted, stop processing, if records were deleted, process the cycle again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But then i realized i needed an iterative counter to track the datasets through each cycle and then i realized i had to write in a split path at the top so that first time through it would take one dataset to start, but second+ it would take the end table from the previous time through, and now i'm wondering if this is even the best way to do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do you guys think?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2016 16:55:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-way-to-repeat-the-same-steps-over-and-over-until-a-value-is/m-p/299339#M63091</guid>
      <dc:creator>MeganE</dc:creator>
      <dc:date>2016-09-19T16:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to repeat the same steps over and over until a value is reached?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-way-to-repeat-the-same-steps-over-and-over-until-a-value-is/m-p/299341#M63093</link>
      <description>&lt;P&gt;Since the question is conceptual only at this point, here are some gut reactions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, since the possibility of an infinite loop exists, I would be very careful to make sure the program ends (regardless of the final coding techniques used).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, I would reuse the same data set name until SAS is sick of it.&amp;nbsp; For example, capture the number of records after step 3 into a macro variable &amp;amp;BEFORE, then capture the number of records after step 4 into &amp;amp;AFTER.&amp;nbsp; See if &amp;amp;BEFORE=&amp;amp;AFTER.&amp;nbsp; Then you don't need to count number of iterations, and you don't need to change the data set names each time.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2016 17:22:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-way-to-repeat-the-same-steps-over-and-over-until-a-value-is/m-p/299341#M63093</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-09-19T17:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to repeat the same steps over and over until a value is reached?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-way-to-repeat-the-same-steps-over-and-over-until-a-value-is/m-p/300369#M63429</link>
      <description>&lt;P&gt;I did end up getting this to work with a do/until and built in counter, but the code is too long to post here.&amp;nbsp; If someone wants to send me a message with a question, feel free.&amp;nbsp; But i don't know how to delete posts, so i'm going to use this one as the solution. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2016 13:29:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-way-to-repeat-the-same-steps-over-and-over-until-a-value-is/m-p/300369#M63429</guid>
      <dc:creator>MeganE</dc:creator>
      <dc:date>2016-09-23T13:29:16Z</dc:date>
    </item>
  </channel>
</rss>

