BookmarkSubscribeRSS Feed
FerhatD
Calcite | Level 5

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;

2 REPLIES 2
SASKiwi
PROC Star

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.

Santt0sh
Lapis Lazuli | Level 10

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;

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 910 views
  • 0 likes
  • 3 in conversation