Hello experts,
I am trying to create new scenario for SAS AML 7.1 tool and I need little help about it.
Business team wants to create alerts about the persons who did same transactions and currency for past 7 days more than 4.
Based on given example below we are expecting that customer number 111 has 4 times same transaction with “2000$” in past 7 days. I would like to create an alert end of the day "16MAR " about this customer.
I'd appreciate it if you could help me with that.
Thanks in advance,
Regards
data sample;
infile datalines;
input date_key date9. transaction_amount currency_key customer_number;
datalines;
17MAR2018 1000 USD 111
16MAR2018 2200 USD 111
15MAR2018 2200 EUR 111
14MAR2018 1500 EUR 111
13MAR2018 2200 USD 111
12MAR2018 1600 USD 111
11MAR2018 2200 USD 111
10MAR2018 2200 USD 111
;
run;
I suggest you track this to SAS Tech Support. Only SAS AML users would be able to help you with this as they are the only ones with access to the AML documentation.
hi,
I am too late for this
PROC SORT DATA = your_data; BY Customer_Number Transaction_Amount currency_key;RUN;
data alerts;
set your_data;
format alert_date date9.;
/* Check for transactions in the last 7 days with the same amount and currency */
by Customer_Number Transaction_Amount currency_key;
retain count;
if first.Customer_Number then count = 0;
if date_key >= intnx('day', today(), -10) and lag(Transaction_Amount) = Transaction_Amount and lag(currency_key) = currency_key then do;
count + 1;
if count >= 4 then do;
alert_date = today();
output;
end;
end;
else count = 0;
drop count;
run;
but one can try
PROC SORT DATA = your_data; BY Customer_Number Transaction_Amount currency_key;RUN;
data alerts;
set your_data;
format alert_date date9.;
/* Check for transactions in the last 7 days with the same amount and currency */
by Customer_Number Transaction_Amount currency_key;
retain count;
if first.Customer_Number then count = 0;
if date_key >= intnx('day', today(), -10) and lag(Transaction_Amount) = Transaction_Amount and lag(currency_key) = currency_key then do;
count + 1;
if count >= 4 then do;
alert_date = today();
output;
end;
end;
else count = 0;
drop count;
run;
PROC SORT DATA = your_data; BY Customer_Number Transaction_Amount currency_key;RUN;
data alerts;
set your_data;
format alert_date date9.;
/* Check for transactions in the last 7 days with the same amount and currency */
by Customer_Number Transaction_Amount currency_key;
retain count;
if first.Customer_Number then count = 0;
if date_key >= intnx('day', today(), -10) and lag(Transaction_Amount) = Transaction_Amount and lag(currency_key) = currency_key then do;
count + 1;
if count >= 4 then do;
alert_date = today();
output;
end;
end;
else count = 0;
drop count;
run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.