<?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 IRR function with large number of payments in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/IRR-function-with-large-number-of-payments/m-p/862505#M340704</link>
    <description>&lt;P&gt;I need to calculate the IRR function with a large number of payments (loans with 360 monthly payments).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The IRR function does calculate the correct value if I list out all 360 payments one by one.&amp;nbsp; I'm looking for a better way to write the code so I'm not writing out the monthly payment 360 times in the code.&lt;/P&gt;</description>
    <pubDate>Mon, 06 Mar 2023 16:07:20 GMT</pubDate>
    <dc:creator>J_Yetman</dc:creator>
    <dc:date>2023-03-06T16:07:20Z</dc:date>
    <item>
      <title>IRR function with large number of payments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IRR-function-with-large-number-of-payments/m-p/862505#M340704</link>
      <description>&lt;P&gt;I need to calculate the IRR function with a large number of payments (loans with 360 monthly payments).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The IRR function does calculate the correct value if I list out all 360 payments one by one.&amp;nbsp; I'm looking for a better way to write the code so I'm not writing out the monthly payment 360 times in the code.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 16:07:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IRR-function-with-large-number-of-payments/m-p/862505#M340704</guid>
      <dc:creator>J_Yetman</dc:creator>
      <dc:date>2023-03-06T16:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: IRR function with large number of payments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IRR-function-with-large-number-of-payments/m-p/862523#M340710</link>
      <description>&lt;P&gt;Do you have the payments in a data set? If so, show an example of the data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is one example using an array to hold multiple payments for use in IRR function. For pretty obvious reasons I'm not going to dummy up 100's of values.&lt;/P&gt;
&lt;PRE&gt;data have;
   input p1-p5;
datalines;
-100 200 100 200 100
-50   10  20  30  40
;

data want;
  set have;
  array p(*) p1-p5;
  rate=irr(1,of p(*));
run;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/279134"&gt;@J_Yetman&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I need to calculate the IRR function with a large number of payments (loans with 360 monthly payments).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The IRR function does calculate the correct value if I list out all 360 payments one by one.&amp;nbsp; I'm looking for a better way to write the code so I'm not writing out the monthly payment 360 times in the code.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 16:36:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IRR-function-with-large-number-of-payments/m-p/862523#M340710</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-03-06T16:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: IRR function with large number of payments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IRR-function-with-large-number-of-payments/m-p/862525#M340711</link>
      <description>&lt;P&gt;The payments are not variable.&amp;nbsp; It's the same payment repeating.&amp;nbsp; So it would be something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IRR(1,-100000,500,500,500,....,500)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 16:40:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IRR-function-with-large-number-of-payments/m-p/862525#M340711</guid>
      <dc:creator>J_Yetman</dc:creator>
      <dc:date>2023-03-06T16:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: IRR function with large number of payments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IRR-function-with-large-number-of-payments/m-p/862547#M340715</link>
      <description>&lt;P&gt;Didn't answer the question: WHERE do these values currently reside?&lt;/P&gt;
&lt;P&gt;If they are not in a data set then you basically have no option but to to type them in. Or read them into a data set to allow something similar to the way I showed above.&lt;/P&gt;
&lt;P&gt;If they are in a data set, then show the structure of that data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF it is ALWAYS the same value then you could build that in a data step like so;&lt;/P&gt;
&lt;PRE&gt;data have;
  array p (50) ;
  p1=-10000;
  do i=2 to 50;
    p[i]=500;
  end;
  rate = irr(1,of p(*));
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Mar 2023 17:55:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IRR-function-with-large-number-of-payments/m-p/862547#M340715</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-03-06T17:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: IRR function with large number of payments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IRR-function-with-large-number-of-payments/m-p/862548#M340716</link>
      <description>&lt;P&gt;Thanks, I understand now.&amp;nbsp; They currently aren't in a data set (at least not in the way that you mean - the value of the payment is pulled from a single variable field in a table).&amp;nbsp; So I'd have to create one.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 17:57:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IRR-function-with-large-number-of-payments/m-p/862548#M340716</guid>
      <dc:creator>J_Yetman</dc:creator>
      <dc:date>2023-03-06T17:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: IRR function with large number of payments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IRR-function-with-large-number-of-payments/m-p/862550#M340717</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/279134"&gt;@J_Yetman&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks, I understand now.&amp;nbsp; They currently aren't in a data set (at least not in the way that you mean - the value of the payment is pulled from a single variable field in a table).&amp;nbsp; So I'd have to create one.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You could just use a little code generation to reuse the same variable name over and over.&lt;/P&gt;
&lt;P&gt;For example this code uses the value of the variable PAYMENT 5 times (the REPEAT function wants the number of EXTRA copies not the total number of copies).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  input id payment ;
  irr5=IRR(1,-100000,of %sysfunc(repeat(%str(payment ),4)));
cards;
1 100
2 200
3 300
4 10000
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 19:03:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IRR-function-with-large-number-of-payments/m-p/862550#M340717</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-03-06T19:03:26Z</dc:date>
    </item>
  </channel>
</rss>

