SAS中文论坛

标题: 请问SAS中的XIRR使用 [打印本页]

作者: shiyiming    时间: 2012-12-20 03:16
标题: 请问SAS中的XIRR使用
求问各位大侠有关XIRR方程的使用~
我看了相关教程,貌似一般情况下使用XIRR或者IRR方程的话,要手动输入数据来计算
但是如果我要计算的数据在dataset中,并且很多很复杂,有没有什么简单的方法调用XIRR来计算呢?

/*
我在一个国外论坛上找到的IRR处理dataset中数据的计算方法如下:
[color=#008040:3awji7wj]proc iml;
use test;
list all;
list;
read all var {c};
show c;/* Call the IRR function in Base SAS. This technique works for any Base SAS function that is expecting a list of arguments instead of a vector.Rick Wicklin */
start myIRR(freq, c);/* convert numeric matrices a single string */
args = strip(putn(freq, "BEST12.")); /* string of the freq value */
cc = strip(putn(c, "BEST12.")); /* character vector of c */
do i = 1 to nrow(cc); /* concatenate all values */
args = concat(args, ",", strip(cc[i]));
end;
cmd = "rate = IRR(" + args + ");" ; /* Base function call, as a string */
call execute(cmd); /* execute the string  */
return (rate); /* return result from Base SAS function */
finish;
freq = 1;
rate = myIRR(freq,c);  /* call Base SAS function with vector */[/color:3awji7wj]
但是不懂怎么运用到XIRR的函数里面。。。
*/




欢迎光临 SAS中文论坛 (http://www.mysas.net/forum/) Powered by Discuz! X3.2