SAS Documentation
SASĀ® Solution for Stress Testing
Reference manual - version 08.2021
Loading...
Searching...
No Matches
irmc_script_data_preparation.sas
1/* ********************************************* */
2/* Data Preparation Script: Input Parameters */
3/* ********************************************* */
4
5/* TGT Authentication Ticket */
6%let rgf_tgt_ticket = ${globals.ticket};
7
8/* Get the root location of the SAS Risk Workgroup Application */
9%let sas_risk_workgroup_dir = ${globals.sas_risk_workgroup_dir};
10
11/* Cycle Id */
12%let cycle_id = ${context.cycle.key};
13
14/* Analysis Run Id */
15%let analysis_run_id = ${context.analysisRun.key};
16
17/* IRM Configuration Set Id */
18%let config_set_id = ${params.CONFIGSETID};
19
20/* Enrich Portfolio table with Counterparty data: Y/N */
21%let enrich_counterparty_flg = ${params.COUNTERPARTYENRICHMENT};
22
23/* Register Rule Sets: Y/N */
24%let register_rulesets_flg = ${params.RULESETREGISTRATION};
25
26/* List of tables to register */
27%let dstore_table_list = ${params.DATASTORETABLELIST};
28/* Convert to space separated list: ["TableName1","TableName2",...,"TableNameN"] --> TableName1 TableName2 ... TableNameN */
29%let dstore_table_list = %sysfunc(prxchange(s/\W+/ /i, -1, %superq(dstore_table_list)));
30
31/* Log Level: 1-4 */
32%let log_level = ${params.LOGLEVEL};
33
34/* Maximum wait time for IRM job completion: <number of seconds> */
35%let max_wait = ${params.MAXWAIT};
36
37/* ********************************************* */
38
39/* Initialize the environment */
40%include "&sas_risk_workgroup_dir./groups/Public/SASRiskManagementCore/cycles/&cycle_id./init.sas" / lrecl = 32000 source2;
41
42/* Set logging options (based on the value of LOG_LEVEL macro variable) */
43%irm_set_logging_options();
44
45/* Set Instance Parameters */
46%let jobflow_category = Analytics;
47%let jobflow_type = %lowcase(irm&solutionId._data_preparation);
48%let instance_date = %sysfunc(date(), yymmddp10.);
49%let instance_time = %sysfunc(prxchange(s/(\d+):(\d+):(\d+)/$1h$2m$3s/i, -1, %sysfunc(time(), tod8.)));
50%let instanceName = Data Preparation &instance_date._&instance_time.;
51%let instanceDesc = Data Preparation;
52
53/* Create parameters table */
54data work.run_option;
55 length
56 config_name $32.
57 config_value $10000.
58 ;
59 config_name = "RMC_FA_ID"; config_value = "&rmc_fa_id."; output;
60 config_name = "CYCLE_ID"; config_value = "&cycle_id."; output;
61 config_name = "ANALYSIS_RUN_ID"; config_value = "&analysis_run_id."; output;
62 config_name = "REGISTER_RULESETS_FLG"; config_value = "&register_rulesets_flg."; output;
63 config_name = "MAX_WAIT"; config_value = "&max_wait."; output;
64 config_name = "LOG_LEVEL"; config_value = "&log_level."; output;
65run;
66
67data work.enrichment_config;
68 length
69 config_name $32.
70 config_value $10000.
71 ;
72 config_name = "DSTORE_TABLE_LIST"; config_value = "&dstore_table_list."; output;
73 config_name = "ENRICH_COUNTERPARTY_FLG"; config_value = "&enrich_counterparty_flg."; output;
74run;
75
76
77%let instanceKey =;
78%let jobflow_status = Unknown;
79/* Create job flow instance and wait for completion */
80%irm_rest_create_jobflow_instance(instance_name = &instanceName.
81 , description = &instanceDesc.
82 , entityId = &entity_id.
83 , entityRoleKey = &entity_role_key.
84 , category = &jobflow_category.
85 , jobflowFile = &jobflow_type.
86 , baseDate = &irm_base_dt.
87 , configSetId = &config_set_id.
88 , federatedAreaID = &irm_fa_id.
89 , sourceFederatedAreaId = &irm_fa_id.
90 , src_param_tables = work.run_option work.enrichment_config
91 , tgt_param_tables = &solutionLibrefPrefix._CFG.RUN_OPTION &solutionLibrefPrefix._CFG.ENRICHMENT_CONFIG
92 , wait_flg = Y
93 , pollInterval = 3
94 , maxWait = &max_wait.
95 , host = &irm_protocol.://&irm_host.
96 , port = &irm_port.
97 , tgt_ticket = &rgf_tgt_ticket.
98 , outvar = instanceKey
99 , outVarStatus = jobflow_status
100 );
101
102/* Update the Cycle control table */
103%irmc_update_ctrl_table(cycle_id = &cycle_id.
104 , analysis_run_id = &analysis_run_id.
105 , dr_libref = &dr_libref.
106 , entry_type = IRM
107 , entry_id = &instanceKey.
108 , entry_name = &instanceName.
109 );