<?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: Calculate expected amount with different terms of payment in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285496#M58391</link>
    <description>&lt;P&gt;Thank you for your trouble.&lt;/P&gt;
&lt;P&gt;It's not what i'm looking for. Perhaps something gets lost in the translation.&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jul 2016 11:31:26 GMT</pubDate>
    <dc:creator>Matthijs</dc:creator>
    <dc:date>2016-07-19T11:31:26Z</dc:date>
    <item>
      <title>Calculate expected amount with different terms of payment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285456#M58366</link>
      <description>&lt;P&gt;Hi everybody,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I work for an insurance company. We sell (among other things) car insurances. Our customers can choose in how many terms&amp;nbsp;they want to pay the insurance:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Once a year&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (complete premium)&lt;/LI&gt;
&lt;LI&gt;Every six months&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (premium split in half)&lt;/LI&gt;
&lt;LI&gt;Each quarter&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (premium split in four)&lt;/LI&gt;
&lt;LI&gt;Every month &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (premium split in twelve)&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I’ve created a set of our current portfolio. I would like to calculate how much premium we expect to receive each month, if nothing changes in our portfolio of course J. I’ve added a fictive set with two months below.&lt;/P&gt;
&lt;TABLE width="1270"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="166"&gt;contract_renewal_month&lt;/TD&gt;
&lt;TD width="114"&gt;product&lt;/TD&gt;
&lt;TD width="93"&gt;paymentterm&lt;/TD&gt;
&lt;TD width="91"&gt;count&lt;/TD&gt;
&lt;TD width="109"&gt;premium_year&lt;/TD&gt;
&lt;TD width="115"&gt;&amp;nbsp;monthly term&amp;nbsp;&lt;/TD&gt;
&lt;TD width="59"&gt;terms&lt;/TD&gt;
&lt;TD width="190"&gt;&amp;nbsp;premium_contract_renewal&amp;nbsp;&lt;/TD&gt;
&lt;TD width="333"&gt;premium_payment&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;car insurance&lt;/TD&gt;
&lt;TD&gt;Half yearly&lt;/TD&gt;
&lt;TD&gt;100&lt;/TD&gt;
&lt;TD&gt;45640&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;€&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 38,03&lt;/TD&gt;
&lt;TD&gt;6&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;€&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22.820,00&lt;/TD&gt;
&lt;TD&gt;value contract_renewal_month 6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;car insurance&lt;/TD&gt;
&lt;TD&gt;yearly&lt;/TD&gt;
&lt;TD&gt;150&lt;/TD&gt;
&lt;TD&gt;65844&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;€&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 36,58&lt;/TD&gt;
&lt;TD&gt;12&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;€&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 65.844,00&lt;/TD&gt;
&lt;TD&gt;-&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;car insurance&lt;/TD&gt;
&lt;TD&gt;quarterly&lt;/TD&gt;
&lt;TD&gt;25&lt;/TD&gt;
&lt;TD&gt;9344&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;€&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 31,15&lt;/TD&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;€&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3.114,67&lt;/TD&gt;
&lt;TD&gt;sum values contract_renewal_month 4,7 and 10&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;car insurance&lt;/TD&gt;
&lt;TD&gt;monthly&lt;/TD&gt;
&lt;TD&gt;350&lt;/TD&gt;
&lt;TD&gt;109994&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;€&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 26,19&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;€&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9.166,17&lt;/TD&gt;
&lt;TD&gt;sum values contract_renewal_month 2 t/m 12&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;car insurance&lt;/TD&gt;
&lt;TD&gt;Half yearly&lt;/TD&gt;
&lt;TD&gt;150&lt;/TD&gt;
&lt;TD&gt;59045&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;€&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 32,80&lt;/TD&gt;
&lt;TD&gt;6&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;€&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 29.522,50&lt;/TD&gt;
&lt;TD&gt;value contract_renewal_month 7&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;car insurance&lt;/TD&gt;
&lt;TD&gt;yearly&lt;/TD&gt;
&lt;TD&gt;150&lt;/TD&gt;
&lt;TD&gt;66899&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;€&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 37,17&lt;/TD&gt;
&lt;TD&gt;12&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;€&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 66.899,00&lt;/TD&gt;
&lt;TD&gt;-&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;car insurance&lt;/TD&gt;
&lt;TD&gt;quarterly&lt;/TD&gt;
&lt;TD&gt;150&lt;/TD&gt;
&lt;TD&gt;55555&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;€&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 30,86&lt;/TD&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;€&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18.518,33&lt;/TD&gt;
&lt;TD&gt;sum values contract_renewal_month 5,8 and 11&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;car insurance&lt;/TD&gt;
&lt;TD&gt;monthly&lt;/TD&gt;
&lt;TD&gt;150&lt;/TD&gt;
&lt;TD&gt;55874&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;€&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 31,04&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;€&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4.656,17&lt;/TD&gt;
&lt;TD&gt;sum values contract_renewal_month 3 t/m 12 and 1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;ect&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;monthly_term = (premium_year)/(count)/12&lt;/P&gt;
&lt;P&gt;premium_contract_renewal = (count)*(monthly_term)*(terms)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I calculate the results as descibed in column ‘premium_payment’ for each contract_renewal_month?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for your time.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 08:08:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285456#M58366</guid>
      <dc:creator>Matthijs</dc:creator>
      <dc:date>2016-07-19T08:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate expected amount with different terms of payment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285468#M58371</link>
      <description>&lt;P&gt;Your data is messed up . Can you post simple data and explain what you want ?&lt;/P&gt;
&lt;P&gt;I notice :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
premium_year=45640;
terms=6;
monthly_term = premium_year/12;
premium_contract_renewal = monthly_term*terms;
put _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Jul 2016 08:42:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285468#M58371</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-19T08:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate expected amount with different terms of payment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285477#M58378</link>
      <description>&lt;P&gt;Attempt two.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA HAVE;
	infile datalines delimiter=',';
	input contr_renew_month product $ payment_term $ count amt_policy amt_month terms amt_contr_ren;
	datalines;
1,	car,	half,	100,	45640,	38.03, 	6,	22820 
1,	car,	year,	150,	65844,	36.58, 	12,	65844 
1,	car,	qrt,	25,	9344,	31.15, 	4,	3114.67 
1,	car,	mnth,	350,	109994,	26.19, 	1,	9166.17 
2,	car,	half,	150,	59045,	32.80, 	6,	29522.50 
2,	car,	year,	150,	66899,	37.17, 	12,	66899.00 
2,	car,	qrt,	150,	55555,	30.86, 	4,	18518.33 
2,	car,	mnth,	150,	55874,	31.04, 	1,	4656.17 
;
RUN;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to create an extra column --&amp;gt; amt_payment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In 'contract_renewal_mont' 1 we don't just receive the payments of the policies where the contract is renewed. We also recieve payments of customers who pay in terms. In this example in month 1:&lt;/P&gt;
&lt;P&gt;SUM(amt_contr_renewal) of 'half' of contr_renew_mnth 6 when then customer has a payment_term 'half'&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SUM(amt_contr_renewal) of&amp;nbsp;'qrt' of contr_renew_mnth&amp;nbsp;4,7,10 when then customer has a payment_term 'qrt'&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SUM(amt_contr_renewal) of 'mnth' of contr_renew_mnth&amp;nbsp;2 - 12&amp;nbsp;when then customer has a payment_term 'mnth'&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;English is not my native language, so I hope you understand my intentions.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 09:20:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285477#M58378</guid>
      <dc:creator>Matthijs</dc:creator>
      <dc:date>2016-07-19T09:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate expected amount with different terms of payment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285483#M58382</link>
      <description>What kind of output would you like to see ? "contr_renew_mnth 4,7,10"  --- here 4,7,10 are all from TERMS variable ?</description>
      <pubDate>Tue, 19 Jul 2016 09:47:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285483#M58382</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-19T09:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate expected amount with different terms of payment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285485#M58383</link>
      <description>&lt;P&gt;Yes.&lt;/P&gt;
&lt;P&gt;In january we (also) receive de quarterly payments for policies with a renewal_month AND with term 'qrt' in 4(apr), 7(jul) and 10(oct).&lt;/P&gt;
&lt;P&gt;So i need a way to sum these amount.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In february we receive de quarterly payments for policies in 5(may), 8(aug) and 11(nov).&lt;/P&gt;
&lt;P&gt;ect ect.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 09:52:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285485#M58383</guid>
      <dc:creator>Matthijs</dc:creator>
      <dc:date>2016-07-19T09:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate expected amount with different terms of payment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285489#M58390</link>
      <description>&lt;P&gt;For each obs use an explicit OUTPUT statement to print out an observation with a variable indicating the payment amount and month you'll receive it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then use proc means/SQL to summarize by months.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I dont quitw understand your data but for example if you have someone who pays twice a year create two rows, each with a variable that indicates month of payment, ie month=1 and month=6&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Heres an example of what the code may look like. I've assumed that renewal is actually a date because that makes more sense than just a month.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data expand;
Set have;

If type='half' then do;
expected = premium/2;
Output; 
Month=intnx('month', renewal_date, 6, 'm');
Output;
End;

Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Jul 2016 10:33:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285489#M58390</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-19T10:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate expected amount with different terms of payment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285496#M58391</link>
      <description>&lt;P&gt;Thank you for your trouble.&lt;/P&gt;
&lt;P&gt;It's not what i'm looking for. Perhaps something gets lost in the translation.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 11:31:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285496#M58391</guid>
      <dc:creator>Matthijs</dc:creator>
      <dc:date>2016-07-19T11:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate expected amount with different terms of payment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285515#M58393</link>
      <description>&lt;P&gt;It will answer your question. How is it not what your looking for?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 13:11:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285515#M58393</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-19T13:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate expected amount with different terms of payment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285702#M58468</link>
      <description>&lt;P&gt;Sorry. I still am not able to get your point . Assuming I understand what you mean.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA HAVE;
	infile datalines delimiter=', ' expandtabs;
	input contr_renew_month product $ payment_term $ count amt_policy amt_month terms amt_contr_ren;
	datalines;
1,	car,	half,	100,	45640,	38.03, 	6,	22820 
1,	car,	year,	150,	65844,	36.58, 	12,	65844 
1,	car,	qrt,	25,	9344,	31.15, 	4,	3114.67 
1,	car,	mnth,	350,	109994,	26.19, 	1,	9166.17 
2,	car,	half,	150,	59045,	32.80, 	6,	29522.50 
2,	car,	year,	150,	66899,	37.17, 	12,	66899.00 
2,	car,	qrt,	150,	55555,	30.86, 	4,	18518.33 
2,	car,	mnth,	150,	55874,	31.04, 	1,	4656.17 
3,	car,	half,	150,	59045,	32.80, 	6,	29522.50 
3,	car,	year,	150,	66899,	37.17, 	12,	66899.00 
3,	car,	qrt,	150,	55555,	30.86, 	4,	18518.33 
3,	car,	mnth,	150,	55874,	31.04, 	1,	4656.17 
4,	car,	half,	150,	59045,	32.80, 	6,	29522.50 
4,	car,	year,	150,	66899,	37.17, 	12,	66899.00 
4,	car,	qrt,	150,	55555,	30.86, 	4,	18518.33 
4,	car,	mnth,	150,	55874,	31.04, 	1,	4656.17 
5,	car,	half,	150,	59045,	32.80, 	6,	29522.50 
5,	car,	year,	150,	66899,	37.17, 	12,	66899.00 
5,	car,	qrt,	150,	55555,	30.86, 	4,	18518.33 
5,	car,	mnth,	150,	55874,	31.04, 	1,	4656.17 
6,	car,	half,	150,	59045,	32.80, 	6,	29522.50 
6,	car,	year,	150,	66899,	37.17, 	12,	66899.00 
6,	car,	qrt,	150,	55555,	30.86, 	4,	18518.33 
6,	car,	mnth,	150,	55874,	31.04, 	1,	4656.17 
7,	car,	half,	150,	59045,	32.80, 	6,	29522.50 
7,	car,	year,	150,	66899,	37.17, 	12,	66899.00 
7,	car,	qrt,	150,	55555,	30.86, 	4,	18518.33 
7,	car,	mnth,	150,	55874,	31.04, 	1,	4656.17 
8,	car,	half,	150,	59045,	32.80, 	6,	29522.50 
8,	car,	year,	150,	66899,	37.17, 	12,	66899.00 
8,	car,	qrt,	150,	55555,	30.86, 	4,	18518.33 
8,	car,	mnth,	150,	55874,	31.04, 	1,	4656.17 
9,	car,	half,	150,	59045,	32.80, 	6,	29522.50 
9,	car,	year,	150,	66899,	37.17, 	12,	66899.00 
9,	car,	qrt,	150,	55555,	30.86, 	4,	18518.33 
9,	car,	mnth,	150,	55874,	31.04, 	1,	4656.17 
10,	car,	half,	150,	59045,	32.80, 	6,	29522.50 
10,	car,	year,	150,	66899,	37.17, 	12,	66899.00 
10,	car,	qrt,	150,	55555,	30.86, 	4,	18518.33 
10,	car,	mnth,	150,	55874,	31.04, 	1,	4656.17 
;
RUN;

proc sql;
select *,case 
 when(payment_term='half') then 
  (select amt_contr_ren from have where contr_renew_month=a.contr_renew_month+5 and payment_term=a.payment_term)
 when(payment_term='qrt') then
  (select sum(amt_contr_ren) from have where (contr_renew_month=a.contr_renew_month+3
  or contr_renew_month=a.contr_renew_month+6 or contr_renew_month=a.contr_renew_month+9) and payment_term=a.payment_term)
 when(payment_term='mnth') then
  (select sum(amt_contr_ren) from have where contr_renew_month between a.contr_renew_month+1 and 12 and payment_term=a.payment_term)
 else . 
end as amt_payment
 from have as a;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jul 2016 01:15:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285702#M58468</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-20T01:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate expected amount with different terms of payment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285746#M58484</link>
      <description>&lt;P&gt;What happens when renewal month is 10 and payments are QTR? The year needs to be accounted for somehow.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 05:40:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/285746#M58484</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-20T05:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate expected amount with different terms of payment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/298509#M62793</link>
      <description>Hi all,

A co-worker found the answer (helped I could explain it in Dutch). I forgot to update the post. Beter late then never.....

DATA work.result ;
  SET work._temp_agg;
  ATTRIB premium_contract_renewal LENGTH= 8 FORMAT=20.2;
  ARRAY amt {12} maandbedrag1-maandbedrag12 ;

  SELECT (betaaltermijn);
    WHEN ('Month')     DO; terms=1;  termijnen=12; END;
    WHEN ('Quarter')  DO; terms=3;  termijnen=4;  END;
    WHEN ('Half year') DO; terms=6;  termijnen=2;  END;
    WHEN ('Year')      DO; terms=12; termijnen=1;  END;
    OTHERWISE;
  END;

  premium_contract_renewal = bestandsamt / termijnen;
  
  DO i = 1 TO 12;

     IF i = prolongatiemaand                       THEN bedrag[i] = premium_contract_renewal; * prolongatieamt ;
     ELSE IF MOD(i - prolongatiemaand, terms ) = 0 THEN amt[i] = premium_contract_renewal;
     ELSE amt[i] = .;
    *PUT _ALL_;

  END;
RUN;

(I suddenly have no options in my post. So I can't put it in a nice sas-look&amp;amp;feel by using 'the running man')</description>
      <pubDate>Thu, 15 Sep 2016 05:42:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/298509#M62793</guid>
      <dc:creator>Matthijs</dc:creator>
      <dc:date>2016-09-15T05:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate expected amount with different terms of payment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/298514#M62795</link>
      <description>Due to proxy-problems I do not have any options on this website. The prev. post isn't readable.....But I can't changeit or delete it. I'm trying to fix it so I can correctly show the post.</description>
      <pubDate>Thu, 15 Sep 2016 05:52:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/298514#M62795</guid>
      <dc:creator>Matthijs</dc:creator>
      <dc:date>2016-09-15T05:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate expected amount with different terms of payment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/298565#M62810</link>
      <description>Click HTML tag, and put the following in it.

&lt;PRE&gt; your sas code here &lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Sep 2016 09:07:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/298565#M62810</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-09-15T09:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate expected amount with different terms of payment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/298566#M62811</link>
      <description>I know.... Our system administrators did 'something' to the proxy, I can't see (or interact) the buttons on de webpage.</description>
      <pubDate>Thu, 15 Sep 2016 09:09:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/298566#M62811</guid>
      <dc:creator>Matthijs</dc:creator>
      <dc:date>2016-09-15T09:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate expected amount with different terms of payment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/298585#M62814</link>
      <description>&lt;PRE&gt;
Check attachment .

&lt;/PRE&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12979i608533132BA73354/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="x.png" title="x.png" /&gt;</description>
      <pubDate>Thu, 15 Sep 2016 09:38:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-expected-amount-with-different-terms-of-payment/m-p/298585#M62814</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-09-15T09:38:25Z</dc:date>
    </item>
  </channel>
</rss>

