<?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: How to derive the interest rate in the mort function in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-derive-the-interest-rate-in-the-mort-function/m-p/803556#M33336</link>
    <description>&lt;P&gt;Yes, you can do that. Solving for the payment as a function of the other variable requires solving for the root of a nonlinear equation. There are &lt;A href="https://blogs.sas.com/content/iml/2020/08/19/find-root-function-sas-data-step.html" target="_self"&gt;many ways to solve for roots in SAS,&lt;/A&gt;&amp;nbsp;but I am going to suggest a way that is easily implemented in a spreadsheet.&lt;/P&gt;
&lt;P&gt;Basically, you loop over a sequence of possible payment values and find the value for which the formula that the MORT function uses is satisfied. Your post includes a link to the doc, which shows the amortization formula.&amp;nbsp; The following DATA step loops over possible payments and finds the value for which the formula is approximately satisfied:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Want;
a = 50000; 
r = 0.1 / 12;
n = 30 * 12;
/* use the formula from the doc:
   p = a*r*(1+r)**n / ( (1+r)**n - 1 ); */
do p = 300 to 600 by 5;  /* find payment to nearest $5 */
   diff = p - a*r*(1+r)**n / ( (1+r)**n - 1 );
   output;
end;
run;

title "Find p such that Diff=0";
proc sgplot data=Want;
   series x=p y=diff;
   refline 0 / axis=y;
run;

proc print data=Want;
where abs(diff)&amp;lt;10;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;From the graph and the printed output, you know that the true value for payment is in the interval [435, 440], since that is where the DIFF variable is close to 0. You can now repeat the computation to find the payment to the nearest cent:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Want;
a = 50000; 
r = 0.1 / 12;
n = 30 * 12;
/* p = a*r*(1+r)**n / ( (1+r)**n - 1 ); */
do p = 435 to 440 by 0.01; /* find payment to nearest cent */
   diff = p - a*r*(1+r)**n / ( (1+r)**n - 1 );
   output;
end;
run;

proc print data=Want;
where abs(diff)&amp;lt;=0.01;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I hope you see how this method can be used in a spreadsheet.&lt;/P&gt;</description>
    <pubDate>Wed, 23 Mar 2022 13:06:57 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2022-03-23T13:06:57Z</dc:date>
    <item>
      <title>How to derive the interest rate in the mort function</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-derive-the-interest-rate-in-the-mort-function/m-p/803406#M33329</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I am working in a task to derive the interest rate using excel spreadsheet. Normally the interest rate (r) is derived using the SAS mort function -&amp;nbsp;&lt;SPAN class=""&gt;MORT&lt;/SPAN&gt;&lt;SPAN&gt;(&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A href="https://documentation.sas.com/doc/en/vdmmlcdc/8.1/ds2ref/n15243fav7jqr6n1amghnmw1vb8i.htm#n0w1x14wzkkmvfn1ucr4rdh2ec15" target="_blank" rel="noopener"&gt;a&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A href="https://documentation.sas.com/doc/en/vdmmlcdc/8.1/ds2ref/n15243fav7jqr6n1amghnmw1vb8i.htm#n03ksh1dlbmv2en123nqn5qjf29r" target="_blank" rel="noopener"&gt;p&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A href="https://documentation.sas.com/doc/en/vdmmlcdc/8.1/ds2ref/n15243fav7jqr6n1amghnmw1vb8i.htm#n1j1bpbx3rgwien1xxkmic2usnc4" target="_blank" rel="noopener"&gt;r&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A href="https://documentation.sas.com/doc/en/vdmmlcdc/8.1/ds2ref/n15243fav7jqr6n1amghnmw1vb8i.htm#n0g7mx1idpwoh3n10zwvsfqg4833" target="_blank" rel="noopener"&gt;n&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;), where a, p and n are already given. (a = amount, p = monthly payment, n = number of periods).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Reference:&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/vdmmlcdc/8.1/ds2ref/n15243fav7jqr6n1amghnmw1vb8i.htm" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/vdmmlcdc/8.1/ds2ref/n15243fav7jqr6n1amghnmw1vb8i.htm&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;Are there any methods to derive the interest rate (r) if it is unknown factor in excel? Or are there any alternative formula can be used?&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;Thanks.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2022 17:27:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-derive-the-interest-rate-in-the-mort-function/m-p/803406#M33329</guid>
      <dc:creator>kelvin0602</dc:creator>
      <dc:date>2022-03-22T17:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive the interest rate in the mort function</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-derive-the-interest-rate-in-the-mort-function/m-p/803409#M33331</link>
      <description>&lt;P&gt;Are you asking how to do this without using SAS at all?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so, likely it is doable but might be a question for an Excel forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My approach would be import data into SAS and use the Mort function, then export results.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2022 17:50:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-derive-the-interest-rate-in-the-mort-function/m-p/803409#M33331</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-03-22T17:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive the interest rate in the mort function</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-derive-the-interest-rate-in-the-mort-function/m-p/803551#M33335</link>
      <description>Also could check FINANCE() function .</description>
      <pubDate>Wed, 23 Mar 2022 12:42:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-derive-the-interest-rate-in-the-mort-function/m-p/803551#M33335</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-03-23T12:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive the interest rate in the mort function</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-derive-the-interest-rate-in-the-mort-function/m-p/803556#M33336</link>
      <description>&lt;P&gt;Yes, you can do that. Solving for the payment as a function of the other variable requires solving for the root of a nonlinear equation. There are &lt;A href="https://blogs.sas.com/content/iml/2020/08/19/find-root-function-sas-data-step.html" target="_self"&gt;many ways to solve for roots in SAS,&lt;/A&gt;&amp;nbsp;but I am going to suggest a way that is easily implemented in a spreadsheet.&lt;/P&gt;
&lt;P&gt;Basically, you loop over a sequence of possible payment values and find the value for which the formula that the MORT function uses is satisfied. Your post includes a link to the doc, which shows the amortization formula.&amp;nbsp; The following DATA step loops over possible payments and finds the value for which the formula is approximately satisfied:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Want;
a = 50000; 
r = 0.1 / 12;
n = 30 * 12;
/* use the formula from the doc:
   p = a*r*(1+r)**n / ( (1+r)**n - 1 ); */
do p = 300 to 600 by 5;  /* find payment to nearest $5 */
   diff = p - a*r*(1+r)**n / ( (1+r)**n - 1 );
   output;
end;
run;

title "Find p such that Diff=0";
proc sgplot data=Want;
   series x=p y=diff;
   refline 0 / axis=y;
run;

proc print data=Want;
where abs(diff)&amp;lt;10;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;From the graph and the printed output, you know that the true value for payment is in the interval [435, 440], since that is where the DIFF variable is close to 0. You can now repeat the computation to find the payment to the nearest cent:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Want;
a = 50000; 
r = 0.1 / 12;
n = 30 * 12;
/* p = a*r*(1+r)**n / ( (1+r)**n - 1 ); */
do p = 435 to 440 by 0.01; /* find payment to nearest cent */
   diff = p - a*r*(1+r)**n / ( (1+r)**n - 1 );
   output;
end;
run;

proc print data=Want;
where abs(diff)&amp;lt;=0.01;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I hope you see how this method can be used in a spreadsheet.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 13:06:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-derive-the-interest-rate-in-the-mort-function/m-p/803556#M33336</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-03-23T13:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive the interest rate in the mort function</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-derive-the-interest-rate-in-the-mort-function/m-p/803786#M33359</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/420463"&gt;@kelvin0602&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Thanks for trusting SAS Forums for your excel issues.&lt;BR /&gt;The excel RATE function helps us calculate interest rate&amp;nbsp; when the initial amount or principal, the monthly payment and payment periods are known. You can have the details here.&lt;BR /&gt;&lt;A href="https://support.microsoft.com/en-us/office/rate-function-9f665657-4a7e-4bb7-a030-83fc59e748ce" target="_blank"&gt;https://support.microsoft.com/en-us/office/rate-function-9f665657-4a7e-4bb7-a030-83fc59e748ce&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 13:12:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-derive-the-interest-rate-in-the-mort-function/m-p/803786#M33359</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2022-03-24T13:12:51Z</dc:date>
    </item>
  </channel>
</rss>

