SAS Documentation
SASĀ® Solution for Stress Testing
Reference manual - version 08.2021
Loading...
Searching...
No Matches
irmst_load_tm_analysis_data.sas
1/*------------------------------------------------------------------------------
2 * NAME: irmst_load_tm_analysis_data.sas
3 *
4 * PURPOSE: Load TM Results as an Analysis Data Object
5 *
6 * MACRO OPTIONS:
7 * ad_analysis_data_name - Name of the instance of the RGF object that is created with a REST request
8 * ad_analysis_data_desc - Description of the instance of the RGF object that is created with a REST request
9 * ad_analysis_run_id - Analysis run instance key of the RGF object that is fetched with a REST request.
10 * ad_base_date - Value of the Base Date field of the instance of the RGF object that is created with a REST request
11 * ad_cycle_id - Numeric Identifier of the SAS Application cycle which the detail data are related to.
12 * ad_details_root - Root to the location where the partition tables are stored.
13 * ad_entity_id - Entity Identifier. If column ENTITY_ID is found in the input table, this parameter is ignored.
14 * ad_libref - Stress Testing Data Repository Libref
15 * ad_meta_library_name - Stress Testing Data Repository Metadata Library Name
16 * ad_schema_version - Value of the Schema Version field of the instance of the RGF object that is created with a REST request
17 * debug - OPTIONAL: Specify TRUE to keep intermediate tables
18 * in_model_group_map - Name of portfolio-level model_group_map
19 * table (input)
20 * in_model_tm_results - Name of TM table from results (input)
21 * in_scenario_meta - Name of scenario metadata (input)
22 * rgf_host - Host name for RGF
23 * rgf_port - Server port for RGF
24 * DEFAULT: 7980
25 * rgf_protocol - Protocol for RGF
26 * rgf_service - Name of the Web Application Server that
27 * provides the REST service for RGF
28 * DEFAULT: SASRiskGovernanceFramework
29 * rgf_solution - Solution identifer for RGF content packages
30 * DEFAULT: stm
31 * tgt_ticket - Specify generated TGT
32 *
33 *------------------------------------------------------------------------------*/
34%macro irmst_load_tm_analysis_data(ad_analysis_data_name = %quote(Transition Matrix Results)
35 , ad_analysis_data_desc = %quote(Transition Matrix Results from Segment-level Analysis Run. \nCreated by user &_metauser. on %sysfunc(datetime(), nldatmw200.).)
36 , ad_analysis_run_id =
37 , ad_base_date =
38 , ad_cycle_id =
39 , ad_details_root =
40 , ad_entity_id =
41 , ad_libref = rqsst
42 , ad_meta_library_name = SAS Stress Testing Data Repository
43 , ad_schema_version =
44 , debug = FALSE
45 , in_model_group_map =
46 , in_model_tm_results =
47 , in_scenario_meta =
48 , rgf_host =
49 , rgf_port =
50 , rgf_protocol =
51 , rgf_service =
52 , rgf_solution =
53 , tgt_ticket =
54 ) / minoperator;
55
56 %local _debug_
57 httpSuccess
58 responseStatus
59 ticket_tm_upload
60 filterable_vars;
61
62 /*-----------------------
63 * Align debug parameter
64 *-----------------------*/
65 %if %qupcase(&debug) in (Y YES 1 TRUE) %then
66 %let _debug_ = YES;
67 %else
68 %let _debug_ = NO;
69
70 /*----------------------------------------
71 * Retrieve meta information to upload
72 *----------------------------------------*/
73 proc sql;
74 create table work._out_tm_results_upload as
75 select b.modeling_system_name label="Modeling System Name",
76 b.modeling_system_version label="Modeling System Version",
77 b.model_group_name label="Modeling System Group name",
78 c.bepname as business_evolution_plan_name label="Business Evolution Plan Name",
79 c.mrsname as master_risk_scenario_name label="Master Risk Scenario Name",
80 c.scenarioid as mip_scenario_name label="MIP Scenario Name",
81 a.insttype,
82 a.scenario_date,
83 a.from_risk_rating label="From Risk Rating",
84 a.to_risk_rating label="Migrated Risk Rating",
85 a.pd_value as transition_probabilities label="Transition Probabilities",
86 a.order_num label="Order Number"
87 from &in_model_tm_results as a,
88 &in_model_group_map as b,
89 (select distinct scenarioid,
90 mrskey,
91 mrsname,
92 bepname
93 from &in_scenario_meta) as c
94 where a.model_group_sk eq b.model_group_sk and
95 upcase(a.insttype) eq upcase(b.insttype) and
96 a.scenario_sk eq c.mrskey
97 order by a.order_num;
98 quit;
99
100 /*-------------------------------------------
101 * Upload modified portfolio data set to RGF
102 *-------------------------------------------*/
103 %let httpSuccess = 0;
104 %let responseStatus = ;
105 %let ticket_tm_upload = ;
106 %let filterable_vars = model_group_name insttype master_risk_scenario_name valuation_date from_risk_rating to_risk_rating;
107
108 %irm_rgf_store_analysis_data(ds_in = work._out_tm_results_upload
109 /* Analysis Data Parameters */
110 , analysis_data_name = %superq(ad_analysis_data_name)
111 , analysis_data_desc = %superq(ad_analysis_data_desc)
112 , base_date = &ad_base_date.
113 , cycle_id = &ad_cycle_id.
114 , status_cd = Preliminary
115 , visibility_cd = Private
116 , analysis_run_id = &ad_analysis_run_id.
117 /* Data Definition Parameters */
118 , data_definition_name = Transition Matrix Results
119 , data_definition_desc = TM Schema Definition
120 , libref = &ad_libref.
121 , meta_library_name = &ad_meta_library_name.
122 , schema_name = ST_TM_RES
123 , schema_version = &ad_schema_version.
124 , schema_type = FLAT
125 , business_category = STM
126 , data_category = RESULTS
127 , risk_type = CREDIT
128 , filterable_vars = &filterable_vars.
129 /* Store details parameters */
130 , workgroup = Public
131 , load_id = Production
132 , entity_id = &ad_entity_id.
133 , constraint_enabled_flg = Y
134 , details_root = &ad_details_root.
135 , details_app = SASStressTesting
136 /* Output tables */
137 , out_exceptions = work._tm_upload_exceptions
138 , out_analysis_data = work._tm_upload_analysis_data
139 , out_partition_list = work._tm_upload_partition_list
140 , out_data_definition = work._tm_upload_data_definition
141 , out_link_instance = work._tm_upload_link_instance
142 /* Connection Parameters */
143 , host = &rgf_protocol.://&rgf_host.
144 , server = &rgf_service.
145 , solution = &rgf_solution.
146 , port = &rgf_port.
147 , tgt_ticket = %superq(tgt_ticket)
148 , outVarTicket = ticket_tm_upload
149 , outSuccess = httpSuccess
150 , outResponseStatus = responseStatus
151 );
152
153 /*----------------------------------------------
154 * If debug set to NO, drop intermediate tables
155 *----------------------------------------------*/
156 %if %qupcase(&_debug_.) eq NO %then
157 %do;
158 proc sql;
159 drop table work._out_tm_results_upload,
160 work._tm_upload_exceptions,
161 work._tm_upload_analysis_data,
162 work._tm_upload_partition_list,
163 work._tm_upload_data_definition,
164 work._tm_upload_link_instance
165 ;
166 quit;
167 %end;
168
169%mend irmst_load_tm_analysis_data;