<?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 Retaining Values in a Do Loop in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Retaining-Values-in-a-Do-Loop/m-p/180290#M34452</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am sure there is a very good reason for this, but I can't seem to get it through my thick head at 2am.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why, when I run the below code, am I retaining the value of the previous OBS when I concatenate using the 3 arguments below?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA ENROLLMENT;&lt;/P&gt;&lt;P&gt;ATTRIB GROUP_ID LENGTH = $400;&lt;/P&gt;&lt;P&gt;DO ID = 1 TO 10;&lt;/P&gt;&lt;P&gt;&amp;nbsp; DO J = 1 TO 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; GROUP_ID = CATS(GROUP_ID,ID,"P");&lt;/P&gt;&lt;P&gt;&amp;nbsp; END;&lt;/P&gt;&lt;P&gt;&amp;nbsp; OUTPUT;&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is driving me nuts.&amp;nbsp; Sorry to ask such a newbie question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Jun 2014 10:07:22 GMT</pubDate>
    <dc:creator>Scott_Mitchell</dc:creator>
    <dc:date>2014-06-02T10:07:22Z</dc:date>
    <item>
      <title>Retaining Values in a Do Loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retaining-Values-in-a-Do-Loop/m-p/180290#M34452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am sure there is a very good reason for this, but I can't seem to get it through my thick head at 2am.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why, when I run the below code, am I retaining the value of the previous OBS when I concatenate using the 3 arguments below?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA ENROLLMENT;&lt;/P&gt;&lt;P&gt;ATTRIB GROUP_ID LENGTH = $400;&lt;/P&gt;&lt;P&gt;DO ID = 1 TO 10;&lt;/P&gt;&lt;P&gt;&amp;nbsp; DO J = 1 TO 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; GROUP_ID = CATS(GROUP_ID,ID,"P");&lt;/P&gt;&lt;P&gt;&amp;nbsp; END;&lt;/P&gt;&lt;P&gt;&amp;nbsp; OUTPUT;&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is driving me nuts.&amp;nbsp; Sorry to ask such a newbie question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Jun 2014 10:07:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retaining-Values-in-a-Do-Loop/m-p/180290#M34452</guid>
      <dc:creator>Scott_Mitchell</dc:creator>
      <dc:date>2014-06-02T10:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: Retaining Values in a Do Loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retaining-Values-in-a-Do-Loop/m-p/180291#M34453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The data step variables are set to missing &lt;SPAN style="text-decoration: underline;"&gt;only&lt;/SPAN&gt; when the complete data step enters its next iteration (think of the jump from "run" to "data"). Between "data" and "run" (or whatever begins the next SAS program step) the variables keep their values, no matter how many SET or OUTPUT statements you have.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Jun 2014 10:17:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retaining-Values-in-a-Do-Loop/m-p/180291#M34453</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-06-02T10:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: Retaining Values in a Do Loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retaining-Values-in-a-Do-Loop/m-p/180292#M34454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep, it looks like the last value is being held over in memory after the output statement.&amp;nbsp; Pop a clean statement in after the output, would need to check the documentation as to exactly what it is doing:&lt;/P&gt;&lt;P&gt;DATA ENROLLMENT;&lt;/P&gt;&lt;P&gt;ATTRIB GROUP_ID LENGTH = $400;&lt;/P&gt;&lt;P&gt;DO ID = 1 TO 10;&lt;/P&gt;&lt;P&gt;&amp;nbsp; DO J = 1 TO 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GROUP_ID = CATs(GROUP_ID,ID,"P");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; group_id="";&lt;/P&gt;&lt;P&gt;&amp;nbsp; END;&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Jun 2014 10:21:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retaining-Values-in-a-Do-Loop/m-p/180292#M34454</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-06-02T10:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: Retaining Values in a Do Loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retaining-Values-in-a-Do-Loop/m-p/180293#M34455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe you can also get around this by using the CALL CATS function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA ENROLLMENT;&lt;/P&gt;&lt;P&gt;ATTRIB GROUP_ID LENGTH = $400;&lt;/P&gt;&lt;P&gt;DO ID = 1 TO 10;&lt;/P&gt;&lt;P&gt;&amp;nbsp; DO J = 1 TO 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; CALL CATS(GROUP_ID,ID,"P");&lt;/P&gt;&lt;P&gt;&amp;nbsp; END;&lt;/P&gt;&lt;P&gt;&amp;nbsp; OUTPUT;&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Jun 2014 11:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retaining-Values-in-a-Do-Loop/m-p/180293#M34455</guid>
      <dc:creator>Keith</dc:creator>
      <dc:date>2014-06-02T11:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: Retaining Values in a Do Loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retaining-Values-in-a-Do-Loop/m-p/180294#M34456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everyone.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2014 05:05:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retaining-Values-in-a-Do-Loop/m-p/180294#M34456</guid>
      <dc:creator>Scott_Mitchell</dc:creator>
      <dc:date>2014-06-03T05:05:50Z</dc:date>
    </item>
  </channel>
</rss>

