全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
3020 2
2019-05-28
数据如下截图,我按照year month sortnum big sent分组,提取sent组下的第一个和最后一个观测的monret,并产生一列新的数据monret0=monret( if first.sent) monret4=monret(if last.sent)
我的程序是这样写的
proc sort data=port;by year month sortnum big sent;run;
data port1;set port;by year month sortnum big sent;
if first.sent then monret_0=monret ;
if last.sent then monret_4=monret ;
run;

但是无法得到我想要的结果
附件列表
sas.png

原图尺寸 23.71 KB

sas.png

二维码

扫码加我 拉你入群

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

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

全部回复
2019-5-28 21:50:16
删掉变量 sortnum, 使用 big 代替sent 作为条件。
proc sort data=port;by year month big sent;run;
data port1;set port;by year month big sent;
if first.big then monret_0=monret ;
if last.big then monret_4=monret ;
run;
二维码

扫码加我 拉你入群

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

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

2019-5-28 22:28:01
自己解答了 应该是by year month big
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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