6%let rgf_tgt_ticket = ${globals.ticket};
9%let sas_risk_workgroup_dir = ${globals.sas_risk_workgroup_dir};
12%let cycle_id = ${context.cycle.key};
15%let analysis_run_id = ${context.analysisRun.key};
18%let config_set_id = ${params.CONFIGSETID};
21%let analysis_data_key = ${params.PORTFOLIO.key};
24%let ruleSet_key = ${params.RULESET.key};
27%let dq_details_flg = ${params.DQDETAILS};
30%let gl_reconciliation_flg = ${params.GLRECONCILIATIONFLG};
33%let general_ledger_key = ${params.GENERALLEDGER.key};
36%let log_level = ${params.LOGLEVEL};
39%let max_wait = ${params.MAXWAIT};
42%let lasr_load_method = ${params.LASRLOADMETHOD};
45%let reload_key_list = ${params.RELOADSUMMARYKEYLIST} ${params.RELOADDETAILSKEYLIST};
48%let reload_key_list = %sysfunc(prxchange(s/\W+/ /i, -1, %superq(reload_key_list)));
51${function:ProcessSpreadsheetParameter(params.RULESETANALYSISDATAMAPPING,
"rulesData")}
54 dataKey = prxchange(
's/.+"key":(\d+).*/$1/', 1, analysisData);
55 ruleKey = prxchange(
's/.+"key":(\d+).*/$1/', 1, ruleSet);
59%let analysis_data_keys=;
65 : rule_set_keys separated by
" ",
66 : analysis_data_keys separated by
" "
73%put &analysis_data_keys.;
75${function:ProcessSpreadsheetParameter(params.RULESETANALYSISLOOKUPDATAMAPPING,
"lookupRulesData")}
78 dataKey = prxchange(
's/.+"key":(\d+).*/$1/', 1, analysisData);
79 ruleKey = prxchange(
's/.+"key":(\d+).*/$1/', 1, ruleSet);
84 ruleKey = prxchange(
's/.+"key":(\d+).*/$1/', 1, ruleSet);
85 primaryAnalysisData = analysisData;
90 ruleKey = prxchange(
's/.+"key":(\d+).*/$1/', 1, ruleSet);
91 lookupAnalysisData = analysisData;
94proc sql nowarn noprint;
95 create table combinedRulesData as
96 select * from rulesData
97 left join lookupRulesData
98 on rulesData.ruleKey eq lookupRulesData.ruleKey;
101proc sort data=combinedRulesData;
105data individualRuleJson;
108set combinedRulesData;
111retain needToCloseLookup;
112if first.ruleKey then
do;
113 * start
this rule array member with key and analysisData;
114 analysisDataKey = prxchange(
's/.+"key":(\d+).*/$1/', 1, analysisData);
115 json = compress(
'{"key":' || ruleKey ||
',"analysisData":' || analysisDataKey);
116 needToCloseLookup = 0;
117 *
if there is at least one lookup start the lookup array;
118 if dataDefinition ne
'' then
do;
119 needToCloseLookup = 1;
120 json = compress(json ||
',"lookup":[');
121 dataDefKey = prxchange(
's/.+"key":(\d+).*/$1/', 1, dataDefinition);
122 analysisDataKey = prxchange(
's/.+"key":(\d+).*/$1/', 1, lookupAnalysisData);
123 json = trim(json) || compress(
'{"ruleId":"' || rule_id ||
'",');
124 json = trim(json) || compress(
'"ruleRowKey":"' || RULESET_ROW_KEY ||
'",');
125 json = trim(json) || compress(
'"dataDef":' || dataDefKey ||
',');
126 json = trim(json) || compress(
'"analysisData":' || analysisDataKey ||
'}');
130if not first.ruleKey then
do;
131*
continue with additional lookup array elements;
132 if dataDefinition ne
'' then
do;
133 dataDefKey = prxchange(
's/.+"key":(\d+).*/$1/', 1, dataDefinition);
134 analysisDataKey = prxchange(
's/.+"key":(\d+).*/$1/', 1, lookupAnalysisData);
135 json = trim(json) || compress(
',{"ruleId":"' || rule_id ||
'",');
136 json = trim(json) || compress(
'"ruleRowKey":"' || RULESET_ROW_KEY ||
'",');
137 json = trim(json) || compress(
'"dataDef":' || dataDefKey ||
',');
138 json = trim(json) || compress(
'"analysisData":' || analysisDataKey ||
'}');
142if last.ruleKey then
do;
143 if needToCloseLookup then
do;
144 json = trim(json) ||
']';
146 json = trim(json) ||
'}';
154 length ruleSetJson $10000;
155 set individualRuleJson end=last;
158 ruleSetJson =
'{"ruleSet":[' || trim (json);
161 ruleSetJson = trim(ruleSetJson) ||
',' || trim(json);
165 ruleSetJson = trim(ruleSetJson) ||
']}';
166 ruleSetJson = tranwrd(ruleSetJson,
'"',
'""');
167 call symput(
'rules_json', ruleSetJson);
174%include
"&sas_risk_workgroup_dir./groups/Public/SASRiskManagementCore/cycles/&cycle_id./init.sas" / lrecl = 32000 source2;
177%irm_set_logging_options();
180%let jobflow_category = Analytics;
181%let jobflow_type = irm%lowcase(&solutionId.)_data_quality;
182%let instance_date = %sysfunc(date(), yymmddp10.);
183%let instance_time = %sysfunc(prxchange(s/(\d+):(\d+):(\d+)/$1h$2m$3s/i, -1, %sysfunc(time(), tod8.)));
184%let instanceName = Data Quality &instance_date._&instance_time. Cycle &cycle_id.;
185%let instanceDesc = Data Quality;
188%let reload_lasr_flg = %irmc_process_lasr_load_method(&lasr_load_method.);
196 config_name = "RMC_FA_ID"; config_value = "&rmc_fa_id."; output;
197 config_name = "CYCLE_ID"; config_value = "&cycle_id."; output;
198 config_name = "ANALYSIS_RUN_ID"; config_value = "&analysis_run_id."; output;
199 config_name = "MAX_WAIT"; config_value = "&max_wait."; output;
200 config_name = "LOG_LEVEL"; config_value = "&log_level."; output;
201 config_name = "RELOAD_LASR_FLG"; config_value = "&reload_lasr_flg."; output;
202 config_name = "TGT_TICKET"; config_value = "&rgf_tgt_ticket."; output;
203 config_name = "RELOAD_KEY_LIST"; config_value = "&reload_key_list."; output;
208 %let quote_option = %sysfunc(getoption(quotelenmax));
210 option noquotelenmax;
217 config_name = "ANALYSIS_DATA_KEY_LIST"; config_value = "&analysis_data_keys."; output;
218 config_name = "DQ_RULE_SET_KEY_LIST"; config_value = "&rule_set_keys."; output;
219 config_name = "DQ_DETAILS_FLG"; config_value = "&dq_details_flg."; output;
220 config_name = "RULES_JSON"; config_value = "&rules_json."; output;
221 config_name = "GL_RECONCILIATION_FLG"; config_value = "&gl_reconciliation_flg."; output;
222 config_name = "GENERAL_LEDGER_KEY"; config_value = "&general_ledger_key."; output;
226option "e_option.;
229%let jobflow_status = Unknown;
231%irm_rest_create_jobflow_instance(instance_name = &instanceName.
232 , description = &instanceDesc.
233 , entityId = &entity_id.
234 , entityRoleKey = &entity_role_key.
235 , category = &jobflow_category.
236 , jobflowFile = &jobflow_type.
237 , baseDate = &irm_base_dt.
238 , configSetId = &config_set_id.
239 , federatedAreaID = &irm_fa_id.
240 , sourceFederatedAreaId = &irm_fa_id.
241 , src_param_tables = work.run_option work.dq_config
242 , tgt_param_tables = &solutionLibrefPrefix._CFG.RUN_OPTION &solutionLibrefPrefix._CFG.DQ_CONFIG
245 , maxWait = &max_wait.
246 , host = &irm_protocol.:
248 , tgt_ticket = &rgf_tgt_ticket.
249 , outvar = instanceKey
250 , outVarStatus = jobflow_status
253%if(&jobflow_status. = Successful) %then %do;
255 %irmc_refresh_lasr_schema_view(lasr_lib = &lasr_libref.
256 , mart_table_name = &solutionId._DQ_SUMMARY
257 , rls_table_name = &solutionId._DQ_SUMMARY_RLS
258 , meta_repository = &meta_repository.
259 , lasr_library_name = &lasr_library_name.
260 , lasr_meta_folder = &lasr_meta_folder.
263 %irmc_refresh_lasr_schema_view(lasr_lib = &lasr_libref.
264 , mart_table_name = &solutionId._DQ_DETAILS
265 , rls_table_name = &solutionId._DQ_DETAILS_RLS
266 , meta_repository = &meta_repository.
267 , lasr_library_name = &lasr_library_name.
268 , lasr_meta_folder = &lasr_meta_folder.
273%irmc_update_ctrl_table(cycle_id = &cycle_id.
274 , analysis_run_id = &analysis_run_id.
275 , dr_libref = &dr_libref.
277 , entry_id = &instanceKey.
278 , entry_name = &instanceName.