DATA Step, Macro, Functions and more

Understanding of SAS AML scenario code SAS10006 .

Reply
Frequent Contributor
Posts: 82

Understanding of SAS AML scenario code SAS10006 .

Hi All, 

 

I am new to SAS AML but I do have basic understanding of BASE SAS ,SAS MACRO and SAS DI/BI.

Can somebody explain me how is scenario code SAS10006 will execute code is given below  ?

from where it will pick up values of variables like p10006_begin_date,run_scenario_init,n ,date_key array,account_type_desc{i}.

 

 

/*==============================================================================
| SAS SCENARIO FILE
|
| PRODUCT: SAS Anti-Money Laundering
| SYSTEM: UNIX/WINDOWS
================================================================================
| NAME: | SAS10006
| |
| CATEGORY: | Cash Activity
| |
| SEVERITY: | Scenario
| |
| FREQUENCY: | Daily
| |
| DURATION: | 5 days
| |
| SUBJECT: | Customer
| |
| PREP FILE: | PARTY_TRANSACTIONS
| |
| HEADER FILE: | party_header
| |
| TRIGGER: | Yes
| |
| DAYS CONSIDERED: | Business
================================================================================

SHORT DESCRIPTION
-----------------
Large Total Cash Transactions

DESCRIPTION
-----------
A customer's total amount of cash transactions exceeds a threshold over several
days.

BUSINESS NOTES
--------------
This scenario calculates the sum of a customer's cash credit and cash debit
transactions over a specified time period. If the total amount of the cash
transactions is greater than or equal to the specified threshold, a match is
found. This scenario considers both credit and debit cash transactions based on
business days. Related scenarios SAS10007 only considers cash deposits and
SAS10020 allows for examining multiple transaction types.

TECHNICAL NOTES
---------------
Not Applicable

MESSAGE
-------
r10006_threshold_message = %str("Total Cash Transactions = #$ #1;
Business Day Count = #2");

SAMPLE MESSAGE
--------------
Total Cash Transactions = USD 20,708; Business Day Count = 5

================================================================================
PARAMETERS

Name Type Default Value
---------------------------------|-------------------|--------------------------
p10006_account_type_desc | Character List | 'P'
p10006_cdi_indicator | Character List | 'C','D'
p10006_currency_acct | Character List | 'N'
p10006_num_days | Numeric Constant | 5
p10006_pri_medium_desc | Character List | 'CASH'
p10006_status_desc | Character List | 'SUCCESS'
p10006_trans_limit | Numeric Constant | 10000
p10006_trans_today | Numeric Constant | 2000
p10006_trans_total | Numeric Constant | 20000

Descriptions
------------
- p10006_account_type_desc
List denoting valid types of accounts

- p10006_cdi_indicator
List denoting credit and debit activities

- p10006_currency_acct
List denoting non-exempt accounts

- p10006_num_days
Number of business days in interval

- p10006_pri_medium_desc
List denoting currency activities

- p10006_status_desc
List denoting completed transactions

- p10006_trans_limit
Maximum single amount of a valid transaction in interval

- p10006_trans_today
Minimum aggregate amount of valid transactions on the current day

- p10006_trans_total
Minimum aggregate amount of valid credits

================================================================================

================================================================================
Copyright (c) 2012 by SAS Institute Inc., Cary, NC 27513 USA
- All rights reserved
==============================================================================*/

/*----------------------------------------------------------------------------
NOTESmiley Embarassed The statement below required for triggering transaction processing
------------------------------------------------------------------------------*/
%let this_macro_name = &sysmacroname; /* save this macro name */
/*----------------------------------------------------------------------------*/

retain p10006_begin_date;
format p10006_day_list $512.;

/* This init section should be placed before any goto statements. This section of
code will only be run when processing the first BY group of the prep data set.
Any goto statements placed before it may prevent the init code from being run. */
if run_scenario_init eq 1 then do;
p10006_begin_date = input(put(rundate_number-&p10006_num_days+1,num_to_date.),8.);
end;

/* Skip parties that do not have transactions on the current day */
if date_key{n} < rundate then goto &sysmacroname.;

p10006_day_list = ' ';
p10006_day_count = 0;
p10006_todays_total = 0;
p10006_total_amount = 0;

do i = n to 1 by -1 until(date_key{i} < p10006_begin_date);
if p10006_begin_date <= date_key{i} <= rundate then do;
if upcase(account_type_desc{i}) in (&p10006_account_type_desc) and
upcase(currency_based_account_ind{i}) in (&p10006_currency_acct) and
upcase(primary_medium_desc{i}) in (&p10006_pri_medium_desc) and
upcase(transaction_cdi_code{i}) in (&p10006_cdi_indicator) and
upcase(status_desc{i}) in (&p10006_status_desc)
then do;
if currency_amount{i} gt &p10006_trans_limit then goto &sysmacroname.;
%save_transaction_key (calling_macro=&this_macro_name);
p10006_total_amount = sum(p10006_total_amount,currency_amount{i});
repeat = indexw(p10006_day_list,strip(put(date_key{i},8.)));
if repeat eq 0 and not missing(date_key{i}) then do;
p10006_day_list = catx(' ',p10006_day_list,put(date_key{i},8.));
p10006_day_count + 1;
end;
if date_key{i} = rundate then
p10006_todays_total = sum(p10006_todays_total,currency_amount{i});
end;
end;
end;

/* Compare party values to parameters for a match */
if p10006_todays_total ge &p10006_trans_today and
p10006_total_amount ge &p10006_trans_total then do;
actual_values_text = tranwrd(&r10006_threshold_message,'#1',strip(put(p10006_total_amount,nlnum32.)) );
actual_values_text = tranwrd(actual_values_text,'#2',strip(put(p10006_day_count,nlnum32.)) );
actual_values_text = tranwrd(actual_values_text,'#$', "&currency_code" );
output &alert_fname;
end;

/* EXIT */
&sysmacroname.:;


/* ========================================================================== */
/* END SCENARIO - SAS10006 */
/* ========================================================================== */

Super User
Posts: 10,280

Re: Understanding of SAS AML scenario code SAS10006 .

This macro is supposed to be called as part of a data step where the data step supplies the variables (most probably from a dataset in set/merge)

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Frequent Contributor
Posts: 82

Re: Understanding of SAS AML scenario code SAS10006 .

Posted in reply to KurtBremser

from where it will pick up values of variables like p10006_begin_date,run_scenario_init,n ,date_key array,account_type_desc{i} ?

where those values are stored ? what will be the input dataset for scenario SAS10006.

Super User
Posts: 10,280

Re: Understanding of SAS AML scenario code SAS10006 .

As I already said, that's up to the data step in which this macro is used. You have to look there. On it's own, the definition of a macro does NOTHING.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Ask a Question
Discussion stats
  • 3 replies
  • 106 views
  • 0 likes
  • 2 in conversation