Hello,
I'm trying to use the FINANCE('XIRR'....) function within the IML (must perform many interactions, so IML is the best place), however, I cannot get it to work. I understand can be done in a Data Step, by transposing the data etc, however, we must run so many loops that the data step option will take to long, Here are two sample codes, trying to load the values from a table on this function, none of these work, any suggestion?
Thanks, Marcos.
/* Test 1 */
data test;
v1 = -10000;
v2 = 2750;
v3 = 4250;
v4 = 3250;
v5 = 2750;
d1 = mdy(1,1,2008);
d2 = mdy(3,1,2008);
d3 = mdy(10,30,2008);
d4 = mdy(2,15,2009);
d5 = mdy(4,1,2009);
/*r = finance('xirr', v1, v2, v3, v4, v5, d1, d2, d3, d4, d5, 0.1);
put r = ;*/
run;
proc iml;
use test;
read all var _ALL_ into test;
values=test[1,];
r=finance('xirr',values, 0.5);
print r;
quit;
/* Test 2 */
data test2;
v1 = -10000;
d1 = mdy(1,1,2008);
output;
v2 = 2750;
d2 = mdy(3,1,2008);
output;
v3 = 4250;
d3 = mdy(10,30,2008);
output;
v4 = 3250;
d4 = mdy(2,15,2009);
output;
v5 = 2750;
d5 = mdy(4,1,2009);
output;
run;
proc iml;
use test2;
read all var _ALL_ into test;
values=test[,1];
dates=test[,2];
print dates;
r=finance('xirr',values, dates, 0.5);
print r;
quit;