Loading...
Searching...
No Matches
mpe_alerts.alert_lib.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief fetch extended values for alert_lib
4 @details Fetches libraries from mpe_tables, creates extended values for
5 alert_ds, and marks "*ALL*" as the forced (default) value.
6
7 Available macro variables:
8 @li DC_LIBREF - The DC control library
9 @li LIBDS - The library.dataset being filtered
10 @li VARIABLE_NM - The column being filtered
11
12
13 <h4> Service Outputs </h4>
14 Output should be a single table called "work.dynamic_values" in the format
15 below. raw_value is unformatted haracter/numeric.
16
17 <h5>DYNAMIC_VALUES</h5>
18 The RAW_VALUE column may be charactor or numeric. If DISPLAY_INDEX is not
19 provided, it is added automatically.
20
21 |DISPLAY_INDEX:best.|RAW_VALUE|
22 |---|---|
23 |1|77.43|
24 |2|88.43|
25
26 <h5>DYNAMIC_EXTENDED_VALUES</h5>
27 This table is optional. If provided, it will map the DISPLAY_INDEX from the
28 DYNAMIC_VALUES table to additional column/value pairs, that will be used to
29 populate dropdowns for _other_ cells in the _same_ row.
30
31 Should be used sparingly! The use of large tables here can slow down the
32 browser.
33
34 The FORCED_VALUE column can be used to force an extended value to be selected
35 by default when a particular value is chosen.
36
37 |DISPLAY_INDEX:best.|EXTRA_COL_NAME:$32.|DISPLAY_TYPE:$1.|RAW_VALUE_NUM|RAW_VALUE_CHAR:$5000|FORCED_VALUE|
38 |---|---|---|---|---|---|
39 |1|DISCOUNT_RT|N|0.5||.|
40 |1|DISCOUNT_RT|N|0.4||0|
41 |1|DISCOUNT_RT|N|0.3||1|
42 |1|CURRENCY_SYMBOL|C||"GBP"|.|
43 |1|CURRENCY_SYMBOL|C||"RSD"|.|
44 |2|DISCOUNT_RT|N|0.5||.|
45 |2|DISCOUNT_RT|N|0.4||1|
46 |2|CURRENCY_SYMBOL|C||"EUR"|.|
47 |2|CURRENCY_SYMBOL|C||"HKD"|1|
48
49 <h4> SAS Macros </h4>
50 @li mp_abort.sas
51
52 @sasjslint {"maxLineLength": 108}
53
54**/
55
56%mp_abort(iftrue= ("%upcase(&libds)" ne "&DC_LIBREF..MPE_ALERTS" )
57 ,mac=&_program
58 ,msg=%str(
59 Invalid validation, expected MPE_ALERTS.ALERT_LIB, got %superq(libds)
60 )
61)
62
63proc sql;
64create table work.source as
65 select libref,dsn
66 from &DC_LIBREF..MPE_TABLES
67 where tx_to > &dc_dttmtfmt.
68 order by 1,2;
69
70data work.DYNAMIC_VALUES (keep=display_index raw_value );
71 set work.source end=last;
72 by libref;
73 if last.libref then do;
74 display_index+1;
75 raw_value=libref;
76 output;
77 end;
78 if last then do;
79 display_index+1;
80 raw_value='*ALL*';
81 output;
82 end;
83run;
84
85
86data work.dynamic_extended_values(keep=display_index extra_col_name display_type
87 RAW_VALUE_CHAR raw_value_num forced_value);
88 set work.source end=last;
89 by libref dsn;
90 retain extra_col_name 'ALERT_DS';
91 retain display_type 'C';
92 retain raw_value_num .;
93 raw_value_char=dsn;
94 forced_value=0;
95
96 if first.libref then display_index+1;
97 if last.libref then do;
98 raw_value_char='*ALL*';
99 forced_value=1;
100 output;
101 end;
102 else output;
103
104run;