<?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 code help- how to seperate subjects with multiple occurances that satisfy a certain condition in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/code-help-how-to-seperate-subjects-with-multiple-occurances-that/m-p/129148#M35212</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi All,&lt;/P&gt;&lt;P&gt;Could some on ehelp me in understanding the code for the question with the title shown above.&lt;/P&gt;&lt;P&gt;Detail codes are given for that question and could some on explain to me why the same dataset is set twice and whats the logic behind...etc etc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Sep 2012 15:20:55 GMT</pubDate>
    <dc:creator>robertrao</dc:creator>
    <dc:date>2012-09-24T15:20:55Z</dc:date>
    <item>
      <title>code help- how to seperate subjects with multiple occurances that satisfy a certain condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/code-help-how-to-seperate-subjects-with-multiple-occurances-that/m-p/129148#M35212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi All,&lt;/P&gt;&lt;P&gt;Could some on ehelp me in understanding the code for the question with the title shown above.&lt;/P&gt;&lt;P&gt;Detail codes are given for that question and could some on explain to me why the same dataset is set twice and whats the logic behind...etc etc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Sep 2012 15:20:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/code-help-how-to-seperate-subjects-with-multiple-occurances-that/m-p/129148#M35212</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-09-24T15:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: code help- how to seperate subjects with multiple occurances that satisfy a certain condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/code-help-how-to-seperate-subjects-with-multiple-occurances-that/m-p/129149#M35213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Time to provide an example of input data and desired output as the topic is very vague.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Sep 2012 17:57:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/code-help-how-to-seperate-subjects-with-multiple-occurances-that/m-p/129149#M35213</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2012-09-24T17:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: code help- how to seperate subjects with multiple occurances that satisfy a certain condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/code-help-how-to-seperate-subjects-with-multiple-occurances-that/m-p/129150#M35214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Ballard,&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;&lt;P&gt;Below is the data I am referring to:&lt;/P&gt;&lt;P&gt;The output I desired is below the data;&lt;/P&gt;&lt;P&gt;This question has been answered (several codes seen below) earlier in the forum......BUT since I am a beginner i want the explanation of the code&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Several ways of code are given below (bottom of this&amp;nbsp; reply)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/*Classic 2X DOW*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/*Merge*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;/*Hash()*/&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;Only the merge method I am familiar&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;Even in that method there are 2 times we set the same dataset......explanation for stuff like this...........&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this data set, I need to separate the records&amp;nbsp; where&amp;nbsp; Arrears_Band at least once has “writoff” value. &lt;/P&gt;&lt;P&gt; data have;&lt;/P&gt;&lt;P&gt;informat Current_date date9.;&lt;/P&gt;&lt;P&gt;Input Current_date&amp;nbsp;&amp;nbsp; Account_number 11-13 Arrears_Band $ 15-25;&lt;/P&gt;&lt;P&gt;Format Current_date date9.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;31MAY2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;30JUN2011&amp;nbsp; 111&amp;nbsp; writoff&lt;/P&gt;&lt;P&gt;31JUL2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31AUG2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;30SEP2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31OCT2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;30NOV2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31DEC2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31JAN2012&amp;nbsp; 111&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31DEC2011&amp;nbsp; 222&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31JAN2012&amp;nbsp; 222&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;30NOV2010&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31DEC2010&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31JAN2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;28FEB2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31MAR2011&amp;nbsp; 333&amp;nbsp; writoff&lt;/P&gt;&lt;P&gt;30APR2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31MAY2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;30JUN2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31JUL2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31AUG2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;30SEP2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31OCT2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;30NOV2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31DEC2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31JAN2012&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;28FEB2010&amp;nbsp; 444&amp;nbsp; Current&lt;/P&gt;&lt;P&gt;31MAR2010&amp;nbsp; 444&amp;nbsp; 30 - 60&lt;/P&gt;&lt;P&gt;30APR2010&amp;nbsp; 444&amp;nbsp; 30 - 60&lt;/P&gt;&lt;P&gt;31MAY2010&amp;nbsp; 444&amp;nbsp; Current&lt;/P&gt;&lt;P&gt;30JUN2010&amp;nbsp; 444&amp;nbsp; Current&lt;/P&gt;&lt;P&gt;31JUL2010&amp;nbsp; 444&amp;nbsp; Current&lt;/P&gt;&lt;P&gt;31AUG2010&amp;nbsp; 444&amp;nbsp; Current&lt;/P&gt;&lt;P&gt;30SEP2010&amp;nbsp; 444&amp;nbsp; Current&lt;/P&gt;&lt;P&gt;31OCT2010&amp;nbsp; 444&amp;nbsp; Current&lt;/P&gt;&lt;P&gt;30NOV2010&amp;nbsp; 444&amp;nbsp; Current&lt;/P&gt;&lt;P&gt;31DEC2010&amp;nbsp; 444&amp;nbsp; Current&lt;/P&gt;&lt;P&gt;31JAN2011&amp;nbsp; 444&amp;nbsp; 1 - 30&lt;/P&gt;&lt;P&gt;28FEB2011&amp;nbsp; 444&amp;nbsp; 30 - 60&lt;/P&gt;&lt;P&gt;31MAR2011&amp;nbsp; 444&amp;nbsp; 60 - 90&lt;/P&gt;&lt;P&gt;30APR2011&amp;nbsp; 444&amp;nbsp; 90 +&lt;/P&gt;&lt;P&gt;31MAY2011&amp;nbsp; 444&amp;nbsp; 90 +&lt;/P&gt;&lt;P&gt;30JUN2011&amp;nbsp; 444&amp;nbsp; 90 +&lt;/P&gt;&lt;P&gt;31JUL2011&amp;nbsp; 444&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31AUG2011&amp;nbsp; 444&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;30SEP2011&amp;nbsp; 444&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31OCT2011&amp;nbsp; 444&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;30NOV2011&amp;nbsp; 444&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31DEC2011&amp;nbsp; 444&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31JAN2012&amp;nbsp; 444&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;28FEB2010&amp;nbsp; 555&amp;nbsp; 30 - 60&lt;/P&gt;&lt;P&gt;31MAR2010&amp;nbsp; 555&amp;nbsp; 30 - 60&lt;/P&gt;&lt;P&gt;30APR2010&amp;nbsp; 555&amp;nbsp; 60 - 90&lt;/P&gt;&lt;P&gt;31MAY2010&amp;nbsp; 555&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31JAN2012&amp;nbsp; 666&amp;nbsp; writoff&lt;/P&gt;&lt;P&gt;31JAN2012&amp;nbsp; 777&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/*Answer*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The data set I want is this.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Current_date&amp;nbsp;&amp;nbsp;&amp;nbsp; Account_number Arrears_Band&lt;/P&gt;&lt;P&gt;31MAY2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;30JUN2011&amp;nbsp; 111&amp;nbsp; writoff&lt;/P&gt;&lt;P&gt;31JUL2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31AUG2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;30SEP2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31OCT2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;30NOV2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31DEC2011&amp;nbsp; 111&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31JAN2012&amp;nbsp; 111&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;30NOV2010&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31DEC2010&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31JAN2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;28FEB2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31MAR2011&amp;nbsp; 333&amp;nbsp; writoff&lt;/P&gt;&lt;P&gt;30APR2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31MAY2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;30JUN2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31JUL2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31AUG2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;30SEP2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31OCT2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;30NOV2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31DEC2011&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31JAN2012&amp;nbsp; 333&amp;nbsp; NPNA&lt;/P&gt;&lt;P&gt;31JAN2012&amp;nbsp; 666&amp;nbsp; writoff&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/*Classic 2X DOW*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until (last.account_number);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by account_number;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if Arrears_Band='writoff' then flag+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do until (last.account_number);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by account_number;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if flag &amp;gt;=1 then output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; call missing(flag);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; drop flag;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/*Merge*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; merge have (where=(Arrears_Band='writoff') in=a) have (in=b);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by account_number;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if a and b;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/*Hash()*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _n_=1 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if 0 then set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dcl hash h(dataset:'have', multidata:'y');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; h.definekey('account_number');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; h.definedata(all:'y');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; h.definedone();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do until (last.account_number);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by account_number;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if Arrears_Band='writoff' then flag+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if flag&amp;gt;=1 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc=h.find();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do rc=0 by 0 while (rc=0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc=h.find_next();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call missing(flag);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; drop flag rc;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Sep 2012 18:27:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/code-help-how-to-seperate-subjects-with-multiple-occurances-that/m-p/129150#M35214</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-09-24T18:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: code help- how to seperate subjects with multiple occurances that satisfy a certain condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/code-help-how-to-seperate-subjects-with-multiple-occurances-that/m-p/129151#M35215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Karun,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I presume you are asking why/how the DOW works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is simply you taking control of the data step.&amp;nbsp; Your code has two loops (i.e., do until statements), each set(ing) the file 'have' with a by statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Each Account_number goes through the two loops separately.&amp;nbsp; Thus, in the first loop, it looks through all of the records that have Account_number 111 and, for each of those that contain an Arrears_Band equal to "write off", it increments a variable called flag.&amp;nbsp; If the Account_number has one such record, flag will be set to 1, if it has two it will be set to 2, etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, in the second loop, it again looks only at the Account_number 111 records, but the value of the flag variable is present in each of the records.&amp;nbsp; If it is greater than one, then the records are output;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, flag is set to missing, and then dropped from the output file, and the system goes back to the first loop and reads account number 222, and so on, and so on.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Sep 2012 19:48:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/code-help-how-to-seperate-subjects-with-multiple-occurances-that/m-p/129151#M35215</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-09-25T19:48:47Z</dc:date>
    </item>
  </channel>
</rss>

