全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1459 3
2014-06-13
我想计算市值加权指数的收益率,首先需要得到权重,也就是上一个交易日的市值(分别是流通市值和总市值),代码如下

data ret;
        set price;
        by code;
        if not first.code then
        do
                weight = lag(mcap);
                fweight = lag(fmcap);
        end;
run;

F3后结果如下,请问为何000001的第二个权重也是缺失值?是我的代码哪里有问题吗
return.png

二维码

扫码加我 拉你入群

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

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

全部回复
2014-6-13 10:05:52
把if not first.code then 这个if条件去掉,看看是不是你想要的结果
二维码

扫码加我 拉你入群

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

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

2014-6-13 12:30:30
复制代码
just  like this, Anyway ,you should understand how pdv runing in SAS software.
二维码

扫码加我 拉你入群

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

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

2014-6-13 12:46:10
hello_fj 发表于 2014-6-13 12:30
just  like this, Anyway ,you should understand how pdv runing in SAS software.
多谢指导
二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群