6%let runDetailedOutput_flg = ${params.RUNDETAILEDOUTPUTFLG};
9%let stage1State_max = ${params.STAGE1STATEMAX};
11%let deteriorationState_delta = ${params.DETERIORATIONSTATEDELTA};
13%let lowPD_max = ${params.LOWPDMAX};
15%let deteriorationPD_delta = ${params.DETERIORATIONPDDELTA};
24%
if &runDetailedOutput_flg. = Y %then %
do;
26 %let detailedOutputCode = %bquote(
27 call addmatrix(CUR_STRS_FRC,0,STRS_FRC);
28 call addmatrix(CUR_STG1_FRC,0,STG1_FRC);
29 call addmatrix(CUR_STG2_FRC,0,STG2_FRC);
33 %let detailedOutputCode =;
38%let stagingCode = %bquote(
48 stagingCode_stage = 1;
51 if (stagingCode_currentState - stagingCode_origState) >= &deteriorationState_delta. then
do;
52 stagingCode_stage = 2;
56 if (stagingCode_currentState > &stage1State_max.) then
do;
57 stagingCode_stage = 2;
61 if ( (stagingCode_currentPD - stagingCode_beginPD) >= &deteriorationPD_delta. and stagingCode_currentPD >= &lowPD_max.) then
do;
62 stagingCode_stage = 2;
74 inherit = (mimp_env.base_risk_env)
76 setoptions NOBACKSAVE;
81proc compile outlib = mipenv.risk_env env = mipenv.risk_env
package = RWA;
83 function OtherRetailRW (PD, LGD)
84 label =
"Other Retail RiskWeight function"
85 kind =
"Basel II RiskWeight";
88 if PD_temp < 0.0003 then PD_temp = 0.0003;
90 PD_CEILING = 1 - 1e-15;
91 if PD_temp > PD_CEILING then PD_temp = PD_CEILING;
93 R = 0.03 * (1 - exp(-35 * PD_temp)) / (1 - exp(-35)) + 0.16 * (1 - (1 - exp(-35 * PD_temp))/(1 - exp(-35)));
94 K = LGD * (probnorm( ((1-R)**(-0.5)) * probit(PD_temp) + ((R/(1-R))**(0.5)) * probit(0.999) )) - PD_temp*LGD;
100 function RevolvingRetailRW (PD, LGD)
101 label =
"Revolving Retail RiskWeight function"
102 kind =
"Basel II RiskWeight";
105 if PD_temp < 0.0003 then PD_temp = 0.0003;
107 PD_CEILING = 1 - 1e-15;
108 if PD_temp > PD_CEILING then PD_temp = PD_CEILING;
111 K = LGD * (probnorm( ((1-R)**(-0.5)) * probit(PD_temp) + ((R/(1-R))**(0.5)) * probit(0.999) ) ) - PD_temp*LGD;
117 function CorporateRW (PD, LGD)
118 label =
"Corporate RiskWeight function"
119 kind =
"Basel II RiskWeight";
122 if PD_temp < 0.0003 then PD_temp = 0.0003;
124 PD_CEILING = 1 - 1e-15;
125 if PD_temp > PD_CEILING then PD_temp = PD_CEILING;
128 R = 0.12 * (1-exp(-50*PD_temp)) / (1-exp(-50)) + 0.24 * ( 1-((1-exp(-50*PD_temp))/(1-exp(-50))) ) -0.04;
129 B = (0.11852 - 0.05478*log(PD_temp))**2;
132 K = (LGD * probnorm( ((1-R)**(-0.5)) * probit(PD_temp) + ((R/(1-R))**(0.5)) * probit(0.999) ) - PD_temp*LGD ) * ((1-1.5*B)**(-1)) * (1+(M-2.5)*B);
138 function ResidentialRW (PD, LGD)
139 label =
"Residential RiskWeight function"
140 kind =
"Basel II RiskWeight";
143 if PD_temp < 0.0003 then PD_temp = 0.0003;
145 PD_CEILING = 1 - 1e-15;
146 if PD_temp > PD_CEILING then PD_temp = PD_CEILING;
150 K = LGD * (probnorm( ((1-R)**(-0.5)) * probit(PD_temp) + ((R/(1-R))**(0.5)) * probit(0.999) ) ) - PD_temp*LGD;