SAS Documentation
SASĀ® Solution for Stress Testing
Reference manual - version 08.2021
Loading...
Searching...
No Matches
irmst_riskagg_corr_mat_check.sas
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 SAS Institute Inc. Cary, NC, USA
3 */
4
5/**
6 \file
7 \anchor irmst_riskagg_corr_mat_check
8 \anchor irmst_riskagg_corr_mat_check_key
9
10 \brief Linear aggregation of risk.
11
12 \param[in] ds_in_corr_mat Unstructured correlation matrix
13
14
15 \details
16
17
18
19
20
21
22 \ingroup RiskAggregation
23
24 \author SAS Institute INC.
25 \date 2020
26
27*/
28
29%macro irmst_riskagg_corr_mat_check( ds_in_corr_mat=
30 );
31
32
33
34 /*Check for solution restriction on correlation matrix*/
35 proc sql noprint;
36 select distinct SCENARIO_ID into :_scenario_ids_ separated by " "
37 from &ds_in_corr_mat.;
38 select distinct _TYPE_ into :_corrtypes_ separated by " "
39 from &ds_in_corr_mat.;
40 quit;
41
42
43 /*Check that the correlation matrix is specified for only two scenarios.*/
44 %if %sysfunc(countw(&_scenario_ids_.,%str( ))) ne 2 %then %do;
45 %put ERROR: the correlation matrix must be specified for 2 scenarios. The attempted specification is for %sysfunc(countw(&_scenario_ids_.,%str( ))) scenario/s;
46 %put ERROR: This error affects the correlation table associated with key &corr_mat_key..;
47 %abort cancel;
48 %end;
49
50 /*Check that the correlation matrix is specified for only for the basecase and the adverse scenarios.*/
51 %do i_scenario_ids=1 %to %sysfunc(countw(&_scenario_ids_.,%str( )));
52 %if ((%upcase(%scan(&_scenario_ids_.,&i_scenario_ids.,%str( ))) ne BASECASE) and (%upcase(%scan(&_scenario_ids_.,&i_scenario_ids.,%str( ))) ne ADVERSE)) %then %do;
53 %put ERROR: the correlation matrix must be specified only for 2 scenarios: Basecase and Adverse. The attempted specification is for the %scan(&_scenario_ids_.,&i_scenario_ids.,%str( )) scenario;
54 %put ERROR: This error affects the correlation table associated with key &corr_mat_key..;
55 %abort cancel;
56 %end;
57 %end;
58
59 /*Check that the correlation matrix _TYPE_ must be unique*/
60 %if %sysfunc(countw(&_corrtypes_.,%str( ))) ne 1 %then %do;
61 %put ERROR: the correlation matrix _TYPE_ must be unique. The attempted specification is for %sysfunc(countw(&_corrtypes_.,%str( ))) types;
62 %put ERROR: This error affects the correlation table associated with key &corr_mat_key..;
63 %abort cancel;
64 %end;
65
66 /*Check that the correlation matrix _TYPE_ is set to corr*/
67 %if (%upcase(&_corrtypes_.) ne CORR) %then %do;
68 %put ERROR: the correlation matrix _TYPE_ must be: corr;
69 %put ERROR: This error affects the correlation table associated with key &corr_mat_key..;
70 %abort cancel;
71 %end;
72
73
74%mend;
75
76
77