开发者社区> 问答> 正文

我的线下评测程序

有时与官方的差一点,有时能完全对上。

用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);


展开
收起
占飞 2016-07-18 22:18:11 3723 0
0 条回答
写回答
取消 提交回答
问答分类:
SQL
问答地址:
问答排行榜
最热
最新

相关电子书

更多
核心: 线下支付技术集成关键点 立即下载
核心:线下支付技术集成关键点 立即下载
PG在电商平台运营决策系统中的应用实践-张亚运 立即下载