有时与官方的差一点,有时能完全对上。
用sas写的,大家凑合看。
/*成绩测算*/
%macro score(submit_list);
data score_list1;
set &submit_list;
by courier_id arrival_time_sub departure;
if last.courier_id;
run;
proc sql;
select sum(departure) as normal into :normal from score_list1;
quit;
/*超时web order*/
data score_list2;
set &submit_list;
where substr(order_id,1,1)="F" and amount<0;
ot=arrival_time_sub-720;
if ot>0;
run;
proc sql;
select sum(ot*5) as web_ot into :web_ot from score_list2;
quit;
/*超时到达shop*/
proc sql;
create table score_list3 as
select a.*,b.pick_time,b.del_time
from &submit_list a,lib3.shop_order2 b
where a.order_id=b.order_id;
quit;
data score_list3_1;
set score_list3;
where amount>0;
ot=arrival_time_sub-pick_time;
if ot>0;
run;
proc sql;
select sum(ot*5) as shop_ot into :shop_ot from score_list3_1;
quit;
/*shop order del超时*/
data score_list4;
set score_list3;
where amount<0;
ot=arrival_time_sub-del_time;
if ot>0;
run;
proc sql;
select sum(ot*5) as shop_del_ot into :shop_del_ot from score_list4;
quit;
data score_sum;
normal=&normal;
web_ot=&web_ot;
shop_ot=&shop_ot;
shop_del_ot=&shop_del_ot;
score_sum=sum(of _all_);
run;
proc sql;
select score_sum from score_sum;
quit;
%mend;
%score(lib3.submit_list);
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。