/*------*/
/* Test */
/*------*/
%let runasofdate = 20171213;
%let header_id = 2;
/* Set error code to 0 */
%let trans_rc = 0;
/* Include Scenario Messages */
filename scenMsgs "!AMLROOT/scenario/codegen/scenario_messages.sas" encoding='windows';
%include scenMsgs;
/* Set alert filenames */
%let alert_fname=work._tempalerts;
%let alert_fname_final=STG_ALER.PARTY_ALERTS&runasofdate ;
/* Set other variables related to storing transaction keys in a data set. */
%let alert_fname_trans_keys=work._tempalerts_trans_keys;
%let alert_fname_final_trans_keys=STG_ALER.trankey_&header_id._&runasofdate ;
%let alert_fname_temp=work._tempalerts2;
/* Macros for each scenario/risk factor */
/* SBIC010 */
%macro fcf_run_scenario_11790 (
p010_curr_deposit_min=,
p010_credit_indicator=,
p010_ctr_amount_limit=,
p010_account_type_desc=,
p010_currency_acct=,
p010_structure_index=,
p010_num_days=,
p010_pri_medium_desc=,
p010_status_desc=,
p010_min_days=
);
%include '!AMLROOT/scenario/scenario_code_active/SBIC010.sas' ;
%mend;
/* End scenario/risk factor macros */
/* Set array_dimension value */
%fcf_calculate_array_dim(ds=MST_PREP.PARTY_TRANSACTIONS, nkey=PARTY_NUMBER);
%fcf_rcset(&syserr);
/* Begin Header Code */
data &alert_fname
(drop=_transaction_key_)
&alert_fname_trans_keys(keep=primary_entity_number scenario_id _transaction_key_)
;
keep primary_entity_number scenario_id rundate actual_values_text entity_level_code
_transaction_key_
;
format rundate date9. actual_values_text $512. entity_level_code $3.;
format primary_entity_number $ 75.;
array DATE_KEY (&array_dimension) _temporary_ ;
array TRANSACTION_CDI_CODE (&array_dimension) $1 _temporary_ ;
array SECONDARY_MEDIUM_DESC (&array_dimension) $20 _temporary_ ;
array STATUS_DESC (&array_dimension) $20 _temporary_ ;
array ACCOUNT_NUMBER (&array_dimension) $50 _temporary_ ;
array ACCOUNT_TYPE_DESC (&array_dimension) $20 _temporary_ ;
array CURRENCY_BASED_ACCOUNT_IND (&array_dimension) $1 _temporary_ ;
array PRIMARY_MEDIUM_DESC (&array_dimension) $20 _temporary_ ;
array MECHANISM_DESC (&array_dimension) $20 _temporary_ ;
array COUNTRY_CODE_3 (&array_dimension) $3 _temporary_ ;
array CURRENCY_CODE (&array_dimension) $3 _temporary_ ;
array CURRENCY_AMOUNT (&array_dimension) _temporary_ ;
array TRANSACTION_KEY (&array_dimension) _temporary_ ;
set MST_PREP.PARTY_TRANSACTIONS
(rename=(
DATE_KEY = temp1
TRANSACTION_CDI_CODE = temp2
SECONDARY_MEDIUM_DESC = temp3
STATUS_DESC = temp4
ACCOUNT_NUMBER = temp6
ACCOUNT_TYPE_DESC = temp7
CURRENCY_BASED_ACCOUNT_IND = temp8
PRIMARY_MEDIUM_DESC = temp15
MECHANISM_DESC = temp16
COUNTRY_CODE_3 = temp17
CURRENCY_CODE = temp18
CURRENCY_AMOUNT = temp19
TRANSACTION_KEY = temp20
))
;
by PARTY_NUMBER ;
if _n_ eq 1 then do;
retain rundate rundate_number entity_level_code run_scenario_init;
rundate = input(put(&runasofdate,8.),yymmdd8.);
rundate_number = input(put(rundate,date_to_num.),8.);
entity_level_code = "PTY";
run_scenario_init = 1;
end;
if first.PARTY_NUMBER then n = 0;
n + 1;
if n le &array_dimension then do;
DATE_KEY{n} = temp1;
TRANSACTION_CDI_CODE{n} = temp2;
SECONDARY_MEDIUM_DESC{n} = temp3;
STATUS_DESC{n} = temp4;
ACCOUNT_NUMBER{n} = temp6;
ACCOUNT_TYPE_DESC{n} = temp7;
CURRENCY_BASED_ACCOUNT_IND{n} = temp8;
PRIMARY_MEDIUM_DESC{n} = temp15;
MECHANISM_DESC{n} = temp16;
COUNTRY_CODE_3{n} = temp17;
CURRENCY_CODE{n} = temp18;
CURRENCY_AMOUNT{n} = temp19;
TRANSACTION_KEY{n} = temp20;
end;
if not last.PARTY_NUMBER then return;
primary_entity_number = PARTY_NUMBER;
/* End Header Code Generation */
/* Call each scenario/risk factor macro after setting scenario_id variable.*/
scenario_id = 11790;
/* SBIC010 */
%fcf_run_scenario_11790 (
p010_curr_deposit_min=950000 ,
p010_credit_indicator=%str('C') ,
p010_ctr_amount_limit=999999999999 ,
p010_account_type_desc=%str('P') ,
p010_currency_acct=%str('N') ,
p010_structure_index=20 ,
p010_num_days=30 ,
p010_pri_medium_desc=%str('FUND') ,
p010_status_desc=%str('SUCCESS') ,
p010_min_days=1
);
run_scenario_init = 0;
drop run_scenario_init;
run;
%fcf_rcset(&syserr);
/*-------------------------------------------
* Determine if transaction keys were saved.
*-------------------------------------------*/
%macro fcf_process_transaction_keys;
%global fcf_process_trans_keys;
%let fcf_process_trans_keys = 0;
%if %sysfunc(exist(&alert_fname_trans_keys)) %then %do;
%let dsid = %sysfunc(open(&alert_fname_trans_keys));
%if &dsid %then %do;
%let fcf_process_trans_keys = %sysfunc(attrn(&dsid, nlobs));
%let rc = %sysfunc(close(&dsid));
%end;
%end;
%if &fcf_process_trans_keys gt 0 %then %do;
/*-------------------------------------------------------
* Scenarios may save duplicate transaction keys.
* Remove duplicates since record of only one is needed.
*-------------------------------------------------------*/
proc sort data=&alert_fname_trans_keys
out=&alert_fname_trans_keys(rename=(_transaction_key_ = transaction_key))
nodupkeys;
by primary_entity_number scenario_id _transaction_key_;
run;
proc sort data=&alert_fname(keep=primary_entity_number scenario_id)
out=&alert_fname_temp;
by primary_entity_number scenario_id;
run;
/*-------------------------------------------------------------------------
* As criteria for an alert is met, scenarios save related transaction
* keys. Later it may be determined that an alert should not be generated
* if additional criteria for the alert is not met, so the keys
* previously saved are no longer needed. Here only transactions keys
* associated with generated alerts (all alert criteria met) are kept.
*-------------------------------------------------------------------------*/
data &alert_fname_trans_keys;
merge &alert_fname_temp(in=alertgen) &alert_fname_trans_keys(in=keys);
by primary_entity_number scenario_id;
if alertgen and keys;
run;
%end; /*if fcf_process_trans_keys gt 0*/
%mend fcf_process_transaction_keys;
%fcf_process_transaction_keys;
... View more