<?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: Select only clients that have all their accounts closed in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88474#M25263</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;min(end_date) isn't recognized as being . so in your example bob is selected because his min end_date is recognized as being 01nov2006.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bob should not be selected because even though he has an account closed on 01nov2006 he has other accounts still open ( other accounts equal to .)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope my explication is clear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Jul 2013 19:39:41 GMT</pubDate>
    <dc:creator>nicnad</dc:creator>
    <dc:date>2013-07-24T19:39:41Z</dc:date>
    <item>
      <title>Select only clients that have all their accounts closed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88468#M25257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table like the following :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Name&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Account_Number&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;END_DATE&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Bob&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12312&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;31DEC9999&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Bob&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;653454&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;31DEC9999&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Bob&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;52423&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01NOV2006&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Martin&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;56637&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;31DEC9999&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Martin&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2656&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;31DEC9999&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Lewis&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;P&gt;7454&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01JUL2003&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Lewis&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;78852&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01JUN2007&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Nicolas&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;696954&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;05MAY2011&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The date 31DEC9999 means that the account is still open&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I write a SAS or SQL procedure so that I can only select the clients name that have all their account closed ( END_DATE before today)? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result would be :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lewis&lt;/P&gt;&lt;P&gt;Nicolas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help and time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jul 2013 17:44:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88468#M25257</guid>
      <dc:creator>nicnad</dc:creator>
      <dc:date>2013-07-24T17:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: Select only clients that have all their accounts closed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88469#M25258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data have ;&lt;/P&gt;&lt;P&gt; length name $20 account_number 8 end_date 8;&lt;/P&gt;&lt;P&gt; informat end_date date9.;&lt;/P&gt;&lt;P&gt; format end_date date9.;&lt;/P&gt;&lt;P&gt; input Name Account_Number END_DATE;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;Bob 12312 31DEC9999&lt;/P&gt;&lt;P&gt;Bob 653454 31DEC9999&lt;/P&gt;&lt;P&gt;Bob 52423 01NOV2006&lt;/P&gt;&lt;P&gt;Martin 56637 31DEC9999&lt;/P&gt;&lt;P&gt;Martin 2656 31DEC9999&lt;/P&gt;&lt;P&gt;Lewis 7454 01JUL2003&lt;/P&gt;&lt;P&gt;Lewis 78852 01JUN2007&lt;/P&gt;&lt;P&gt;Nicolas 696954 05MAY2011&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sql ;&lt;/P&gt;&lt;P&gt; select name from have&lt;/P&gt;&lt;P&gt; group by name&lt;/P&gt;&lt;P&gt; having max(end_date) &amp;lt; '31DEC9999'd&lt;/P&gt;&lt;P&gt; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jul 2013 18:03:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88469#M25258</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-07-24T18:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: Select only clients that have all their accounts closed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88470#M25259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My bad, I deleted my previous post I totally missed out that you could have multiple records for a single account, some of which dated back when the account was still open.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom's by processing will do it. If END_DATE is stored as character instead of numeric in your DS, simply replace max(end_date) by max(input(end_date, date9.))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vincent&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jul 2013 18:09:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88470#M25259</guid>
      <dc:creator>Vince28_Statcan</dc:creator>
      <dc:date>2013-07-24T18:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: Select only clients that have all their accounts closed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88471#M25260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you both for your replies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom solution works great!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jul 2013 18:11:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88471#M25260</guid>
      <dc:creator>nicnad</dc:creator>
      <dc:date>2013-07-24T18:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: Select only clients that have all their accounts closed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88472#M25261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Quick question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What if I have account where the end date is&amp;nbsp; empty. An empty end date should return the same as if the end date was 31DEC9999.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table would be like this and should return Nicolas and Lewis :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have ;&lt;/P&gt;&lt;P&gt;length name $20 account_number 8 end_date 8;&lt;/P&gt;&lt;P&gt;informat end_date date9.;&lt;/P&gt;&lt;P&gt;format end_date date9.;&lt;/P&gt;&lt;P&gt;input Name Account_Number END_DATE;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;Bob 12312 .&lt;/P&gt;&lt;P&gt;Bob 653454 .&lt;/P&gt;&lt;P&gt;Bob 52423 01NOV2006&lt;/P&gt;&lt;P&gt;Martin 56637 .&lt;/P&gt;&lt;P&gt;Martin 2656 .&lt;/P&gt;&lt;P&gt;Lewis 7454 01JUL2003&lt;/P&gt;&lt;P&gt;Lewis 78852 01JUN2007&lt;/P&gt;&lt;P&gt;Nicolas 696954 05MAY2011&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your help and time!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jul 2013 19:18:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88472#M25261</guid>
      <dc:creator>nicnad</dc:creator>
      <dc:date>2013-07-24T19:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Select only clients that have all their accounts closed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88473#M25262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just add another condition to Tom's code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;having max(end_date) &amp;lt; '31DEC9999'd And min(end_date) &amp;gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Haikuo&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jul 2013 19:33:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88473#M25262</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-07-24T19:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: Select only clients that have all their accounts closed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88474#M25263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;min(end_date) isn't recognized as being . so in your example bob is selected because his min end_date is recognized as being 01nov2006.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bob should not be selected because even though he has an account closed on 01nov2006 he has other accounts still open ( other accounts equal to .)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope my explication is clear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jul 2013 19:39:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88474#M25263</guid>
      <dc:creator>nicnad</dc:creator>
      <dc:date>2013-07-24T19:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: Select only clients that have all their accounts closed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88475#M25264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does anyone has an idea or do I have to clarify my problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you all for your help and time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Really appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jul 2013 20:38:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88475#M25264</guid>
      <dc:creator>nicnad</dc:creator>
      <dc:date>2013-07-24T20:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Select only clients that have all their accounts closed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88476#M25265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;proc sql ;&lt;/P&gt;&lt;P&gt; select name from have&lt;/P&gt;&lt;P&gt; group by name&lt;/P&gt;&lt;P&gt; having max(coalesce(end_date,'31Dec9999'd)) &amp;lt; '31DEC9999'd&lt;/P&gt;&lt;P&gt; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jul 2013 20:52:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88476#M25265</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2013-07-24T20:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: Select only clients that have all their accounts closed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88477#M25266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Simple yet brilliant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jul 2013 21:07:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88477#M25266</guid>
      <dc:creator>nicnad</dc:creator>
      <dc:date>2013-07-24T21:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: Select only clients that have all their accounts closed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88478#M25267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;proc sql ;&lt;/P&gt;&lt;P&gt;select name from have&lt;/P&gt;&lt;P&gt;group by name&lt;/P&gt;&lt;P&gt;having sum(end_date gt today())=0 and sum(missing(end_date))=0&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jul 2013 02:34:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-only-clients-that-have-all-their-accounts-closed/m-p/88478#M25267</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-07-25T02:34:40Z</dc:date>
    </item>
  </channel>
</rss>

