SAS中文论坛

标题: Finance function求救!!! [打印本页]

作者: shiyiming    时间: 2011-5-31 12:59
标题: Finance function求救!!!
我用SAS9.2,需要求accrued interest,我找到finance function可用。

当我读入单独一个值的时候,是可用的,譬如:
data temp;
   issue = mdy(6,8,1999);
   firstinterestdate = mdy(12,1,1999);
   date = mdy(7,9,2002);
   rate = 0.095;
   par = 1000;
   frequency = 2;
   basis = 0;
run;

data temp2; set temp;  r = finance('accrint', issue, firstinterestdate, date, rate, par, frequency, basis); run;

这样是可行的。


但是当我应用于一个dataset的时候就不行了,我的dataset如下,大约有50多w个obs
ID        issue        firstinterestdate        date        rate        par        frequency        basis
A        8/6/1999        1/12/1999        1/7/2002        0.095        1000        2        0
A        8/6/1999        1/12/1999        2/7/2002        0.095        1000        2        0
A        8/6/1999        1/12/1999        3/7/2002        0.095        1000        2        0
B        8/6/1999        1/12/1999        8/7/2002        0.095        1000        2        0
B        8/6/1999        1/12/1999        9/7/2002        0.095        1000        2        0
B        8/6/1999        1/12/1999        10/7/2002        0.095        1000        2        0
C        8/6/1999        1/12/1999        11/7/2002        0.095        1000        2        0
C        8/6/1999        1/12/1999        12/7/2002        0.095        1000        2        0
C        8/6/1999        1/12/1999        15/7/2002        0.095        1000        2        0
C        8/6/1999        1/12/1999        16/7/2002        0.095        1000        2        0

再应用finance function就报错,所有的r都求不出来,这是为什么啊?有没有大虾给我解释一下啊?谢谢!!!
作者: shiyiming    时间: 2011-5-31 13:40
标题: Re: Finance function求救!!!
检查下数据的格式。
作者: shiyiming    时间: 2011-5-31 14:12
标题: Re: Finance function求救!!!
搞定,那个frequency是character的格式了,改过来就好了,还有就是有些数据错误的问题,呵呵,万分感谢!

<!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->  <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->  <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->  <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->  <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->  <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->




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