SAS Documentation
SASĀ® Solution for Stress Testing
Reference manual - version 08.2021
Loading...
Searching...
No Matches
irmc_script_result_adjust_alloc.sas
1/* ************************************************ */
2/* Adjustment Allocation 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/* Analysis Data key */
18%let analysis_data_key = ${params.ANALYSISDATA.key};
19
20/* Adjustment Analysis Data key */
21%let adjustment_data_key = ${params.ADJUSTMENTDATA.key};
22
23/* Schema Name and Version of the Data Definition object associated with this Analysois Data object */
24%let schema_name = ${params.ANALYSISDATA.nav("analysisData_dataDefinition|RMC")[0].schemaName};
25%let schema_version = ${params.ANALYSISDATA.nav("analysisData_dataDefinition|RMC")[0].schemaVersion};
26
27/* RuleSet Key */
28%let ruleSet_key = ${params.RULESET.key};
29
30/* Movement Type code */
31%let movement_type_cd = ${params.MOVEMENTTYPECD};
32
33/* Movement Description */
34%let movement_desc = ${params.MOVEMENTDESC};
35
36/* IRM Configuration Set Id */
37%let config_set_id = ${params.CONFIGSETID};
38
39/* Log Level: 1-4 */
40%let log_level = ${params.LOGLEVEL};
41
42/* Maximum wait time for IRM job completion: <number of seconds> */
43%let max_wait = ${params.MAXWAIT};
44
45/* LASR load method (Append/Replace) */
46%let lasr_load_method = ${params.LASRLOADMETHOD};
47
48/* List of analysis data objecs to reload (if lasr_load_method = replace) */
49%let reload_key_list = ${params.RELOADKEYLIST};
50/* Convert to space separated list: ["<key1>","<key2>",...,"<keyN>"] --> <key1> <key2> ... <keyN> */
51%let reload_key_list = %sysfunc(prxchange(s/\W+/ /i, -1, %superq(reload_key_list)));
52
53/* ********************************************* */
54
55/* Initialize the environment */
56%include "&sas_risk_workgroup_dir./groups/Public/SASRiskManagementCore/cycles/&cycle_id./init.sas" / lrecl = 32000 source2;
57
58/* Set logging options (based on the value of LOG_LEVEL macro variable) */
59%irm_set_logging_options();
60
61/* Assign config and mapping libraries */
62libname cfg_lib "&irm_fa_path./landing_area/base/%lowcase(&config_set_id.)/static";
63libname map_lib "&irm_fa_path./landing_area/base/%lowcase(&config_set_id.)/mapping";
64
65/* Process LASR load method */
66%let reload_lasr_flg = %irmc_process_lasr_load_method(&lasr_load_method.);
67
68/* Set the reportmart group id */
69%let reportmart_group_id = Credit Risk;
70
71%if (&movement_type_cd. eq IA_ADJ) %then %do;
72 %let jobflow_status=Unknown;
73 /* Run the individual adjustments */
74 %irmc_run_ia(credit_risk_data_key = &analysis_data_key.
75 , adjustment_data_key = &adjustment_data_key.
76 , run_id = &analysis_run_id.
77 , dr_libref = &dr_libref.
78 , dr_library_name = &dr_library_name.
79 , schema_name = &schema_name.
80 , schema_version = &schema_version.
81 , cycle_id = &cycle_id.
82 , entity_id = &entity_id.
83 , rgf_tgt_ticket = &rgf_tgt_ticket.
84 , rgf_protocol = &rgf_protocol.
85 , rgf_host = &rgf_host.
86 , rgf_port = &rgf_port.
87 , rgf_service = &rgf_service.
88 , rgf_solution = &rgf_solution.
89 , reportmart_group_id = &reportmart_group_id.
90 );
91 /* Load the reportmart table */
92 %irmc_load_reportmart(partition_no = 1
93 , ds_in_cardinality =
94 , ds_in_reportmart_config = reportmart_config
95 , ds_out_load_result = load_result
96 , irm_input_libraries =
97 , dr_libref = &dr_libref.
98 , dr_library_name = &dr_library_name.
99 , mart_libref = &mart_libref.
100 , rgf_protocol = &rgf_protocol.
101 , rgf_host = &rgf_host.
102 , rgf_port = &rgf_port.
103 , rgf_service = &rgf_service.
104 , rgf_solution = &rgf_solution.
105 , rgf_tgt_ticket = &rgf_tgt_ticket.
106 );
107%end; /* end %if (movement_type_cd eq IA_ADJ) */
108%else %do;
109 /* Set Instance Parameters */
110 %let jobflow_category = Analytics;
111 %let jobflow_type = %lowcase(irm&solutionId._adjustment_allocation);
112 %let instance_date = %sysfunc(date(), yymmddp10.);
113 %let instance_time = %sysfunc(prxchange(s/(\d+):(\d+):(\d+)/$1h$2m$3s/i, -1, %sysfunc(time(), tod8.)));
114 %let instanceName = Adjustment Allocation &instance_date._&instance_time.;
115 %let instanceDesc = Adjustment Allocation;
116
117 /* Run option table */
118 data work.run_option;
119 length
120 config_name $32.
121 config_value $10000.
122 ;
123 config_name = "RMC_FA_ID"; config_value = "&rmc_fa_id."; output;
124 config_name = "CYCLE_ID"; config_value = "&cycle_id."; output;
125 config_name = "ANALYSIS_RUN_ID"; config_value = "&analysis_run_id."; output;
126 config_name = "MAX_WAIT"; config_value = "&max_wait."; output;
127 config_name = "LOG_LEVEL"; config_value = "&log_level."; output;
128 config_name = "RELOAD_LASR_FLG"; config_value = "&reload_lasr_flg."; output;
129 config_name = "RELOAD_KEY_LIST"; config_value = "&reload_key_list."; output;
130 run;
131
132 /* Credit Stress parameters table */
133 data work.allocation_config;
134 length
135 config_name $32.
136 config_value $100.
137 ;
138 config_name = "ANALYSIS_DATA_KEY"; config_value = "&analysis_data_key."; output;
139 config_name = "ANALYSIS_DATA_DS_NAME"; config_value = "&schema_name."; output;
140 config_name = "RULESET_KEY"; config_value = "&ruleSet_key."; output;
141 config_name = "MOVEMENT_TYPE_CD"; config_value = "&movement_type_cd."; output;
142 config_name = "MOVEMENT_DESC"; config_value = "&movement_desc."; output;
143 run;
144
145
146 %let instanceKey =;
147 %let jobflow_status = Unknown;
148 /* Create job flow instance and wait for completion */
149 %irm_rest_create_jobflow_instance(instance_name = &instanceName.
150 , description = &instanceDesc.
151 , entityId = &entity_id.
152 , entityRoleKey = &entity_role_key.
153 , category = &jobflow_category.
154 , jobflowFile = &jobflow_type.
155 , baseDate = &irm_base_dt.
156 , configSetId = &config_set_id.
157 , federatedAreaID = &irm_fa_id.
158 , sourceFederatedAreaId = &irm_fa_id.
159 , src_param_tables = work.run_option work.allocation_config
160 , tgt_param_tables = &solutionLibrefPrefix._CFG.RUN_OPTION &solutionLibrefPrefix._CFG.ALLOCATION_CONFIG
161 , autoRun = true
162 , wait_flg = Y
163 , pollInterval = 3
164 , maxWait = &max_wait.
165 , host = &irm_protocol.://&irm_host.
166 , port = &irm_port.
167 , tgt_ticket = &rgf_tgt_ticket.
168 , outvar = instanceKey
169 , outVarStatus = jobflow_status
170 );
171%end;
172
173%if(&movement_type_cd. = IA_ADJ or &jobflow_status. = Successful) %then %do;
174 /* Refresh the Star Schema Views */
175 %irmc_refresh_lasr_schema_view(lasr_lib = &lasr_libref.
176 , mart_table_name = &schema_name.
177 , rls_table_name = &schema_name._rls
178 , meta_repository = &meta_repository.
179 , lasr_library_name = &lasr_library_name.
180 , lasr_meta_folder = &lasr_meta_folder.
181 );
182%end;
183
184/* Update the Cycle control table */
185%irmc_update_ctrl_table(cycle_id = &cycle_id.
186 , analysis_run_id = &analysis_run_id.
187 , dr_libref = &dr_libref.
188 , entry_type = IRM
189 , entry_id = &instanceKey.
190 , entry_name = &instanceName.
191 );