![在反洗钱中计算和的代码] [1] 我正在处理事务监控中的aml场景开发。我正计算过去10天的货币金额总和。
问题是,我们在10march2018到19march2018之间只有10天的数据。 当我将rundate作为3月3日给出时它没有给出输出,但它在其他条件下给出输出并且循环应该只运行10天。
如果该代码和计算中有任何错误,请发给我正确的代码和
的想法。
SA
data sample data;
infile cards;
input party_number10. currency_amount10. date_key date9.;
cards;
1 2000 10mar2018
1 1000 10mar2018
2 2000 10mar2018
2 10000 10mar2018
1 2000 11mar2018
2 1000 12mar2018
1 2000 13mar2018
2 1000 13mar2018
1 2000 14mar2018
2 1000 15mar2018
;
expecting sum of currency amount on each party_num wise in 10days like
party_number Total
1 9000
2 13000
enter code here
%let this_macro_name = &sysmacroname;
%let p113_period_days=10;/*parameter in aml front*/
%let agg_amount =100000;/*parameter in aml front*/
p113_I_begin_date = input(put(rundate_number-&p113_period_days+1,num_to_date.),8.);
do i = n to 1 by -1 while (date_key{i} >= p113_I_begin_date);
if p113_I_begin_date <= date_key{i} <= rundate then
do;
if upcase(transaction_cdi_code{i}) in (&p113_cdi_indicator) and
upcase(primary_medium_desc{i}) in (&p113_pri_medium_desc) then
do;
%fcf_save_transaction_key(calling_macro=&this_macro_name);
p113_total_amount = sum(p113_total_amount,currency_amount{i});
end;
end;
end;
if p113_total_amount>=&agg_amount then
do;
actual_values_text = tranwrd(&r10007_threshold_message,'#1',kstrip(put(p113_total_amount,nlnum32.)) );
output &alert_fname;
end;