SAS Documentation
SASĀ® Solution for Stress Testing
Reference manual - version 08.2021
Loading...
Searching...
No Matches
irmst_node_attribution_init.sas
Go to the documentation of this file.
1/*
2 Copyright (C) 2018 SAS Institute Inc. Cary, NC, USA
3*/
4
5/** \file
6 \brief Retrieve Attribution Analysis Configuration
7
8 \param[in] ST_PRM.RUN_OPTION parameter table
9 \param[out] ST_STG.ATTRIBUTION_CONFIG Output table containing details of the Attribution Analysis
10
11 \details
12
13 This node makes a call to macro \link irm_rest_get_rgf_attribution.sas \endlink to retrieve the attribution analysis configuration that is linked to the current analysis run.
14
15 In addition the following macro utilities are called:
16
17 | Macro name | Description | Further information |
18 |---------------------------|--------------------------------------------------------------------------------------------------------------|-----------------------------------------------|
19 | irm_session_prepare | Reads RUN_OPTION table and sets logging options | \link irm_session_prepare.sas \endlink |
20 | irm_session_cleanup | Removes all non-IRM WORK datasets/views and deletes all user-created macro variables from workspace session | \link irm_session_cleanup.sas \endlink |
21
22 \ingroup nodes
23 \author SAS Institute Inc.
24 \date 2018
25*/
26
27/* Initialize session */
28%irm_session_prepare();
29
30%let ticket =;
31%irm_rest_get_rgf_attribution(host = &rgf_protocol.://&rgf_host.
32 , server = &rgf_service.
33 , solution = &rgf_solution.
34 , port = &rgf_port.
35 , tgt_ticket = &tgt_ticket.
36 , key = &attribution_analysis_key.
37 , details_flg = Y
38 , outds = tmp_attribution_config
39 , outVarTicket = ticket
40 , outSuccess = httpSuccess
41 , outResponseStatus = responseStatus
42 , restartLUA = Y
43 , clearCache = Y
44 );
45
46proc sort data = tmp_attribution_config;
47 by attributionGroupNo;
48run;
49
50/* Post-process */
51data &ds_out_attribution_config.
52 &ds_out_attribution_run_config. (drop = attributeName attributionType);
53 length
54 attributionKey 8.
55 attributionGroupNo 8.
56 run_sequence_no 8.
57 runFlg $1.
58 previous_result_key $100.
59 current_result_key $100.
60 previous_portfolio_key $100.
61 current_portfolio_key $100.
62 portfolio_switch_flg $1.
63 portfolio_override_varlist $10000.
64 previous_analysis_run_id $32.
65 current_analysis_run_id $32.
66 scenario_switch_flg $1.
67 scenario_override_varlist $10000.
68 previous_model_run_key $32.
69 current_model_run_key $32.
70 model_switch_flg $1.
71 previous_counterparty_key $100.
72 current_counterparty_key $100.
73 previous_mitigant_key $100.
74 current_mitigant_key $100.
75 previous_modelInputMap_key $100.
76 current_modelInputMap_key $100.
77 previous_modelOutputMap_key $100.
78 current_modelOutputMap_key $100.
79 previous_ia_data_key $100.
80 current_ia_data_key $100.
81 previous2_fr_htm_data_key $100.
82 previous_fr_htm_data_key $100.
83 previous2_afs_data_key $100.
84 previous_afs_data_key $100.
85 ;
86 set tmp_attribution_config(rename = (key = attributionKey));
87 by attributionGroupNo;
88
89 retain
90 portfolio_switch_flg "N"
91 scenario_switch_flg "N"
92 model_switch_flg "N"
93 ;
94
95 retain
96 runFlg
97 portfolio_override_varlist
98 scenario_override_varlist
99 ;
100
101 drop cum_sequence_no;
102 retain cum_sequence_no;
103
104 /* Set static parameters */
105 attributionKey = &attribution_analysis_key.;
106 previous_result_key = "&prev_result_key.";
107 current_result_key = "&curr_result_key.";
108 previous_portfolio_key = "&prev_portfolio_key.";
109 current_portfolio_key = "&portfolio_key.";
110 previous_analysis_run_id = "&attrib_prev_analysis_run_id.";
111 current_analysis_run_id = "&attrib_curr_analysis_run_id.";
112 previous_model_run_key = "&prev_credit_model_run_key.";
113 current_model_run_key = "&credit_model_run_key.";
114 previous_counterparty_key = "&prev_counterparty_key.";
115 current_counterparty_key = "&counterparty_key.";
116 previous_mitigant_key = "&prev_mitigant_key.";
117 current_mitigant_key = "&mitigant_key.";
118 previous_modelInputMap_key = "&prev_modelin_datamap_key.";
119 current_modelInputMap_key = "&modelin_datamap_key.";
120 previous_modelOutputMap_key = "&prev_modelout_datamap_key.";
121 current_modelOutputMap_key = "&modelout_datamap_key.";
122 previous_ia_data_key = "&prev_ia_data.";
123 current_ia_data_key = "&ia_data.";
124 previous2_fr_htm_data_key = "&prev2_fr_htm_data.";
125 previous_fr_htm_data_key = "&prev_fr_htm_data.";
126 previous2_afs_data_key = "&prev2_afs_data.";
127 previous_afs_data_key = "&prev_afs_data.";
128
129 /* Reset RunFlg */
130 if(first.attributionGroupNo) then
131 runFlg = "N";
132
133 /* Flag which changes require a model run */
134 if(attributionType in ("PortfolioAging" "PortfolioAttribute" "PortfolioSwitch" "ScenarioRiskFactor" "ScenarioSwitch" "Model")) then
135 runFlg = "Y";
136
137 if(attributionType = "PortfolioSwitch") then do;
138 portfolio_switch_flg = "Y";
139 call missing(portfolio_override_varlist);
140 end;
141
142 if(attributionType = "ScenarioSwitch") then do;
143 scenario_switch_flg = "Y";
144 call missing(scenario_override_varlist);
145 end;
146
147 if(attributionType = "Model") then
148 model_switch_flg = "Y";
149
150 /* Keep track of all portfolio attributes being changed (cumulative override) */
151 if(attributionType = "PortfolioAttribute" and portfolio_switch_flg = "N") then
152 portfolio_override_varlist = catx(" ", portfolio_override_varlist, attributeName);
153
154 /* Keep track of all portfolio attributes being changed (cumulative override) */
155 if(attributionType = "ScenarioRiskFactor" and scenario_switch_flg = "N") then
156 scenario_override_varlist = catx(" ", scenario_override_varlist, attributeName);
157
158
159 /* No need to run anything if we have switched Porflio, Scenarios and Model (-> this is the current period result) */
160 if(portfolio_switch_flg = "Y" and scenario_switch_flg = "Y" and model_switch_flg = "Y") then
161 runFlg = "N";
162
163 if last.attributionGroupNo and runFlg = "Y" then do;
164 cum_sequence_no + 1;
165 run_sequence_no = cum_sequence_no;
166 output &ds_out_attribution_run_config.;
167 end;
168
169 output &ds_out_attribution_config.;
170
171run;
172
173data &ds_out_attribution_option.;
174 set &ds_in_run_option.;
175 /* Override the number of partitions to be used for the attribution analysis */
176 if config_name = "N_PARTITIONS" then
177 config_value = "&attribution_n_partitions.";
178run;
179
180/* Cleanup session */
181%irm_session_cleanup;