楼主: mengha
1169 0

[问答] 累计收益的程序的处理结果不是很明白,求大神解读宏 [推广有奖]

  • 2关注
  • 0粉丝

已卖:1份资源

博士生

32%

还不是VIP/贵宾

-

威望
0
论坛币
1 个
通用积分
2.1564
学术水平
2 点
热心指数
3 点
信用等级
1 点
经验
2854 点
帖子
128
精华
0
在线时间
375 小时
注册时间
2008-11-29
最后登录
2020-2-15

楼主
mengha 发表于 2016-2-8 14:07:07 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
    我想要计算股指累计60个月的收益率,用了以下的宏,但是2016年1月也有数值,我不知道是否这个程序有问题,或者应该怎么理解我跑出来的结果,求大神指教~
76C7.tm.png

%macro calcret;
data paper.IDX_Idxtrdmth1;
set paper.IDX_Idxtrdmth1;
  by indexcd;

/* Take natural logs of the index return (idxrtn)  */

   lidxrtn=log(idxrtn+1);

/* Define arrays to create the lagged values */

    array lagidxrtn[59] lagidxrtn1-lagidxrtn59;

/* This is the macro portion: a "do-loop" to create the 59 necessary lags */

    %do j=1 %to 59;
       lagidxrtn&j=lag&j(lidxrtn);
    %end;

/* The following statements set to missing lagged values that */
/* are reading the data corresponding to the previous idxcd  */

    if first.indexcd then count=1;
    do i=count to 59;
      lagidxrtn = .;
    end;
    count +1 ;

/* Calculate the cumulative returns by adding the logs of the returns*/

    idxcumret= exp( sum(of lidxrtn lagidxrtn1-lagidxrtn59)) -1;

/* Drop unnecessary variables */

    drop l: count i;

%mend calcret;  /* End of macro  */
%calcret;       /* Run the macro */



二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:计收益 cumulative Statements Necessary calculate 程序 收益 necessary natural return

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-1 16:38