<?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 Pick Monthend accounts continuously where balance greater than limits for past 3 months in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Pick-Monthend-accounts-continuously-where-balance-greater-than/m-p/643888#M192218</link>
    <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have pasted below sample data to get help on the sas logic.&lt;/P&gt;&lt;P&gt;Question: I need to get the list of all account that&amp;nbsp; have balance greater than credit limit for continuously past 3 months(90 days).&lt;/P&gt;&lt;P&gt;On the reporting month data(Mar20) i picked all accounts where Balance &amp;gt; Limit ...(around 8k acts out of 1.2million acts)&lt;/P&gt;&lt;P&gt;I again subquery to get all the 8k accounts past 4 months data and sorted by month end .And clauluated the diff filed and flags too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On this data (test2), I need to pull accounts comapring past 3 months (like for Mar20- comapre Dec19,Jan20,Feb200 that has contionusly negative diff i.e., balance &amp;gt; credit lmit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test;&lt;BR /&gt;input Accno$3. Month_End $10. Balance 8. Limit 8.;&lt;BR /&gt;datalines;&lt;BR /&gt;402 31-Dec-19 7978.91 7500&lt;BR /&gt;402 31-Jan-20 8127.20 7500&lt;BR /&gt;402 29-Feb-20 6902.12 7500&lt;BR /&gt;402 31-Mar-20 8369.17 7500&lt;BR /&gt;405 31-Dec-19 1712.83 7500&lt;BR /&gt;405 31-Jan-20 1762.32 7500&lt;BR /&gt;405 29-Feb-20 1762.32 0&lt;BR /&gt;405 31-Mar-20 1762.32 0&lt;BR /&gt;406 31-Dec-19 7978.91 7500&lt;BR /&gt;406 31-Jan-20 8127.20 7500&lt;BR /&gt;406 29-Feb-20 6902.12 7500&lt;BR /&gt;406 31-Mar-20 8369.17 7500&lt;BR /&gt;407 31-Dec-19 8000.00 7500&lt;BR /&gt;407 31-Jan-20 8000.00 7500&lt;BR /&gt;407 29-Feb-20 8000.01 7500&lt;BR /&gt;407 31-Mar-20 8000.01 7500&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data= test; by accno /*Month_End*/; run;&lt;BR /&gt;data test2;&lt;BR /&gt;set test;&lt;BR /&gt;IF Balance &amp;gt; Limit then Flag = 'Y' ;else Flag = 'N';&lt;BR /&gt;diff= Balance -Limit;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output: I should get only 407 accno ...as this account has contionuly negative diff for past 90 days..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any help or advise apprecited.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Apr 2020 12:13:48 GMT</pubDate>
    <dc:creator>BaalaRaaji</dc:creator>
    <dc:date>2020-04-29T12:13:48Z</dc:date>
    <item>
      <title>Pick Monthend accounts continuously where balance greater than limits for past 3 months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pick-Monthend-accounts-continuously-where-balance-greater-than/m-p/643888#M192218</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have pasted below sample data to get help on the sas logic.&lt;/P&gt;&lt;P&gt;Question: I need to get the list of all account that&amp;nbsp; have balance greater than credit limit for continuously past 3 months(90 days).&lt;/P&gt;&lt;P&gt;On the reporting month data(Mar20) i picked all accounts where Balance &amp;gt; Limit ...(around 8k acts out of 1.2million acts)&lt;/P&gt;&lt;P&gt;I again subquery to get all the 8k accounts past 4 months data and sorted by month end .And clauluated the diff filed and flags too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On this data (test2), I need to pull accounts comapring past 3 months (like for Mar20- comapre Dec19,Jan20,Feb200 that has contionusly negative diff i.e., balance &amp;gt; credit lmit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test;&lt;BR /&gt;input Accno$3. Month_End $10. Balance 8. Limit 8.;&lt;BR /&gt;datalines;&lt;BR /&gt;402 31-Dec-19 7978.91 7500&lt;BR /&gt;402 31-Jan-20 8127.20 7500&lt;BR /&gt;402 29-Feb-20 6902.12 7500&lt;BR /&gt;402 31-Mar-20 8369.17 7500&lt;BR /&gt;405 31-Dec-19 1712.83 7500&lt;BR /&gt;405 31-Jan-20 1762.32 7500&lt;BR /&gt;405 29-Feb-20 1762.32 0&lt;BR /&gt;405 31-Mar-20 1762.32 0&lt;BR /&gt;406 31-Dec-19 7978.91 7500&lt;BR /&gt;406 31-Jan-20 8127.20 7500&lt;BR /&gt;406 29-Feb-20 6902.12 7500&lt;BR /&gt;406 31-Mar-20 8369.17 7500&lt;BR /&gt;407 31-Dec-19 8000.00 7500&lt;BR /&gt;407 31-Jan-20 8000.00 7500&lt;BR /&gt;407 29-Feb-20 8000.01 7500&lt;BR /&gt;407 31-Mar-20 8000.01 7500&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data= test; by accno /*Month_End*/; run;&lt;BR /&gt;data test2;&lt;BR /&gt;set test;&lt;BR /&gt;IF Balance &amp;gt; Limit then Flag = 'Y' ;else Flag = 'N';&lt;BR /&gt;diff= Balance -Limit;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output: I should get only 407 accno ...as this account has contionuly negative diff for past 90 days..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any help or advise apprecited.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 12:13:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pick-Monthend-accounts-continuously-where-balance-greater-than/m-p/643888#M192218</guid>
      <dc:creator>BaalaRaaji</dc:creator>
      <dc:date>2020-04-29T12:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Pick Monthend accounts continuously where balance greater than limits for past 3 months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pick-Monthend-accounts-continuously-where-balance-greater-than/m-p/643899#M192226</link>
      <description>&lt;P&gt;You only have the last 4 months in the dataset, so one entry with balance &amp;lt; limit shall cause the flag to be 'N':&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
by accno;
retain flag;
if first.accno then flag = 'Y';
if balance &amp;lt; limit then flag = 'N';
if last.accno and flag = 'Y';
keep accno flag;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Apr 2020 12:39:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pick-Monthend-accounts-continuously-where-balance-greater-than/m-p/643899#M192226</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-29T12:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: Pick Monthend accounts continuously where balance greater than limits for past 3 months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pick-Monthend-accounts-continuously-where-balance-greater-than/m-p/643928#M192245</link>
      <description>The above logic is not working properly...&lt;BR /&gt;just need to pull all accounts that have balance greater then Limit for the continuously for the past 3 months...</description>
      <pubDate>Wed, 29 Apr 2020 13:24:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pick-Monthend-accounts-continuously-where-balance-greater-than/m-p/643928#M192245</guid>
      <dc:creator>BaalaRaaji</dc:creator>
      <dc:date>2020-04-29T13:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: Pick Monthend accounts continuously where balance greater than limits for past 3 months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pick-Monthend-accounts-continuously-where-balance-greater-than/m-p/643948#M192255</link>
      <description>&lt;P&gt;Per your initial posting, you should only get account 409.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Accno :$3. Month_End :date11. Balance Limit;
datalines;
402 31-Dec-19 7978.91 7500
402 31-Jan-20 8127.20 7500
402 29-Feb-20 6902.12 7500
402 31-Mar-20 8369.17 7500
405 31-Dec-19 1712.83 7500
405 31-Jan-20 1762.32 7500
405 29-Feb-20 1762.32 0
405 31-Mar-20 1762.32 0
406 31-Dec-19 7978.91 7500
406 31-Jan-20 8127.20 7500
406 29-Feb-20 6902.12 7500
406 31-Mar-20 8369.17 7500
407 31-Dec-19 8000.00 7500
407 31-Jan-20 8000.00 7500
407 29-Feb-20 8000.01 7500
407 31-Mar-20 8000.01 7500
;

data want;
set have;
by accno;
retain flag;
if first.accno then flag = 'Y';
if balance &amp;lt; limit then flag = 'N';
if last.accno and flag = 'Y';
keep accno flag;
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;Accno	flag
407	Y
&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Apr 2020 13:52:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pick-Monthend-accounts-continuously-where-balance-greater-than/m-p/643948#M192255</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-29T13:52:54Z</dc:date>
    </item>
    <item>
      <title>logic to get all accounts that has balance &gt; limit contionusly for past 3 months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pick-Monthend-accounts-continuously-where-balance-greater-than/m-p/643949#M192259</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the sample data and i need to get all accounts that have balance &amp;gt; limit continuously past 3 months...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;data test;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;input Accno$3. Month_End $10. Balance 8. Limit 8.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;datalines;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;402 31-Dec-19 7978.91 7500&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;402 31-Jan-20 8127.20 7500&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;402 29-Feb-20 6902.12 7500&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;402 31-Mar-20 8369.17 7500&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;405 31-Dec-19 1712.83 7500&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;405 31-Jan-20 1762.32 7500&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;405 29-Feb-20 1762.32 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;405 31-Mar-20 1762.32 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;406 31-Dec-19 7978.91 7500&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;406 31-Jan-20 8127.20 7500&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;406 29-Feb-20 6902.12 7500&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;406 31-Mar-20 8369.17 7500&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;407 31-Dec-19 8000.00 7500&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;407 31-Jan-20 8000.00 7500&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;407 29-Feb-20 8000.01 7500&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;407 31-Mar-20 8000.01 7500&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 13:52:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pick-Monthend-accounts-continuously-where-balance-greater-than/m-p/643949#M192259</guid>
      <dc:creator>BaalaRaaji</dc:creator>
      <dc:date>2020-04-29T13:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: logic to get all accounts that has balance &gt; limit contionusly for past 3 months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pick-Monthend-accounts-continuously-where-balance-greater-than/m-p/643951#M192260</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/44464"&gt;@BaalaRaaji&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please do not post the same question twice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test1;
input Accno$3. Month_End $10. Balance 8. Limit 8.;
prev_acct=lag(Accno);
if Accno^=prev_acct then flag=0;
if balance&amp;gt;limit then flag+1;
else flag=0;
if flag=3 then output;
drop prev_acct;
datalines;
402 31-Dec-19 7978.91 7500
402 31-Jan-20 8127.20 7500
402 29-Feb-20 6902.12 7500
402 31-Mar-20 8369.17 7500
405 31-Dec-19 1712.83 7500
405 31-Jan-20 1762.32 7500
405 29-Feb-20 1762.32 0
405 31-Mar-20 1762.32 0
406 31-Dec-19 7978.91 7500
406 31-Jan-20 8127.20 7500
406 29-Feb-20 6902.12 7500
406 31-Mar-20 8369.17 7500
407 31-Dec-19 8000.00 7500
407 31-Jan-20 8000.00 7500
407 29-Feb-20 8000.01 7500
407 31-Mar-20 8000.01 7500
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 14:02:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pick-Monthend-accounts-continuously-where-balance-greater-than/m-p/643951#M192260</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-29T14:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: logic to get all accounts that has balance &gt; limit contionusly for past 3 months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pick-Monthend-accounts-continuously-where-balance-greater-than/m-p/643953#M192261</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/44464"&gt;@BaalaRaaji&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please do not post the same question twice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Cleaned that up...&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 14:04:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pick-Monthend-accounts-continuously-where-balance-greater-than/m-p/643953#M192261</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-29T14:04:58Z</dc:date>
    </item>
  </channel>
</rss>

