sas 怎么另变量自动等于下一个观测值,类似于next方法
datazhuangtai1;setzhuangtai(drop=rolesserial_number);byuserid;formatvalid_from_dtvali...
data zhuangtai1;
set zhuangtai(drop = roles serial_number);
by userid;
format valid_from_dt valid_to_dt yymmdd10.;
retain valid_to_dt 0;
valid_from_dt = trade_date;
if last.userid = 1 then do;
valid_to_dt = "31dec9999"d;
end;
else if last.userid ~= 1 then do ;
valid_to_dt = ;/*这个位置我想另它等于下一个观测,应该怎么做呢*/
end;
label userid = '用户编号' trade_status = '交易状态' trade_date = '交易日期'
lkh = '开户' lcz = '充值' ltb = '投标' ltx = '体现' lzqzr = '债券转让' ;
run; 展开
set zhuangtai(drop = roles serial_number);
by userid;
format valid_from_dt valid_to_dt yymmdd10.;
retain valid_to_dt 0;
valid_from_dt = trade_date;
if last.userid = 1 then do;
valid_to_dt = "31dec9999"d;
end;
else if last.userid ~= 1 then do ;
valid_to_dt = ;/*这个位置我想另它等于下一个观测,应该怎么做呢*/
end;
label userid = '用户编号' trade_status = '交易状态' trade_date = '交易日期'
lkh = '开户' lcz = '充值' ltb = '投标' ltx = '体现' lzqzr = '债券转让' ;
run; 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏30(财富值+成长值)
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询