%macro ww(a,b);
options validvarname=any;
proc import out=lwd.aug
datafile="C:\Users\Administrator\Desktop\充值記錄\&a..xls"
dbms=excel replace;
run;
data lwd.aug_1;
set lwd.aug;
實(shí)際=input(實(shí)際到賬金額,20.);
run;
proc sql;
create table lwd.aug_2 as
select 用戶名,支付方式,實(shí)際 from lwd.aug_1 where 用戶名 not in (select
borrower.用戶名 from lwd.borrower) ;
quit;
proc sql;
create table lwd.aug_3 as
select 用戶名, 支付方式,實(shí)際 from lwd.aug_2
proc sql;
create table lwd.aug_4 as
select 用戶名,sum(實(shí)際) as 充值金額 from lwd.aug_3 group by 用戶名;
quit;
proc import out=lwd.aug26tx
datafile="C:\Users\Administrator\Desktop\全部\&b..xls"
dbms=excel replace;
sheet='tx';
run;
proc import out=lwd.aug_26cz
datafile="C:\Users\Administrator\Desktop\全部\&b..xls"
dbms=excel replace;
sheet='cz';
run;
proc import out=lwd.aug_26invest
datafile="C:\Users\Administrator\Desktop\全部\&b..xls"
dbms=excel replace;
sheet='invest';
run;
proc sql;
create table lwd.aug_26t as
select 用戶名,sum(操作金額) as 提現(xiàn)金額 from Lwd.Aug26tx where 用戶名 not in (select
borrower.用戶名 from lwd.borrower) group by 用戶名;
quit;
proc sql;
create table lwd.aug_26i as
select 用戶名,sum(操作金額) as 投資金額 from Lwd.Aug_26invest group by 用戶名;
quit;
proc sql;*/去掉borrower中的借款人/*;
create table lwd.aug_26c as
select 用戶名,sum(操作金額) as 充值金額 from Lwd.Aug_26cz where 用戶名 not in (select
borrower.用戶名 from lwd.borrower) group by 用戶名;
quit;
proc sort data=lwd.aug_26c;
by 用戶名;
run;
proc sort data=lwd.aug_4;
by 用戶名;
run;
data lwd.merge;*/不用了/*;
merge lwd.aug_3 lwd.aug_26c;
by 用戶名;
run;
proc sort data=lwd.aug_26t;
by 用戶名;
run;
proc sort data=lwd.aug_26i;
by 用戶名;
run;
*/篩選投資成功中的約標(biāo)和非約標(biāo)的人/*;
proc sql;
create table lwd.aug_26i1 as
select 用戶名,備注,操作金額 from Lwd.Aug_26invest where 備注 like '%約標(biāo)%';
quit;
data lwd.aug26a;
set lwd.aug_26i1;
約標(biāo)標(biāo)種=scan(scan(scan(備注,2,">"),2,"】"),1,"月")||"月";
run;
proc sql;
create table lwd.aug_26i2 as
select 用戶名,備注,操作金額 from Lwd.Aug_26invest where 備注 not like '%約標(biāo)%';
quit;
data lwd.aug26b;
set lwd.aug_26i2;
正式標(biāo)種=scan(scan(備注,2,">"),1,"月")||"月";;
run;
proc sort data=lwd.aug26a ;
by 用戶名;
run;
proc sort data=lwd.aug26b ;
by 用戶名;
run;
data aug26;
keep 用戶名 約標(biāo)標(biāo)種 正式標(biāo)種;
set lwd.aug26a lwd.aug26b;
by 用戶名;
run;
proc transpose data=aug26 out=b name=約標(biāo) prefix=y;
by 用戶名;
var 約標(biāo)標(biāo)種 ;
run;
proc sort data=b;
by 用戶名;
run;
proc transpose data=aug26 out=c name=正式標(biāo) prefix=z;
by 用戶名;
var 正式標(biāo)種 ;
run;
proc sort data=c;
by 用戶名;
run;
data bc;
merge b c;
by 用戶名;
run;
data lwd.aug_26;
merge lwd.aug_4 lwd.aug_26i lwd.aug_26t bc ;
by 用戶名;
run;
data lwd.aug26;*/將缺失值替換為0/*;
set lwd.aug_26;
array var _numeric_;
do over var;
if var =. then var=0;
end;
run;
proc export data=lwd.aug26
outfile='C:\Users\Administrator\Desktop\每日金額統(tǒng)計(jì)\活動(dòng)2.xls'
dbms=excel replace;
sheet="&a";
run;
%mend ww;
%ww(sep2,b);