Loading...
Searching...
No Matches
columns_in_libds.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Generic validator for table columns
4 @details The input table is simply one row from the target table in table
5 called "work.source_row".
6
7 Available macro variables:
8 @li MPELIB - The DC control library
9 @li LIBDS - The library.dataset being filtered
10 @li VARIABLE_NM - The column being filtered
11
12 <h4> Service Inputs </h4>
13 <h5> work.sourcerow </h5>
14 Has source table structure.
15
16 <h4> Service Outputs </h4>
17
18 The values provided below are generic samples - we encourage you to replace
19 these with realistic values in your own deployments.
20
21 <h5>DYNAMIC_VALUES</h5>
22 The RAW_VALUE column may be charactor or numeric. If DISPLAY_INDEX is not
23 provided, it is added automatically.
24
25 |DISPLAY_INDEX:best.|RAW_VALUE|
26 |---|---|
27 |1|77.43|
28 |2|88.43|
29
30 <h5>DYNAMIC_EXTENDED_VALUES</h5>
31 This table is optional. If provided, it will map the DISPLAY_INDEX from the
32 DYNAMIC_VALUES table to additional column/value pairs, that will be used to
33 populate dropdowns for _other_ cells in the _same_ row.
34
35 Should be used sparingly! The use of large tables here can slow down the
36 browser.
37
38 |DISPLAY_INDEX:best.|EXTRA_COL_NAME:$32.|DISPLAY_TYPE:$1.|RAW_VALUE_NUM|RAW_VALUE_CHAR:$5000|
39 |---|---|---|
40 |1|DISCOUNT_RT|N|0.5||
41 |1|DISCOUNT_RT|N|0.4||
42 |1|DISCOUNT_RT|N|0.3||
43 |1|CURRENCY_SYMBOL|C||"GBP"|
44 |1|CURRENCY_SYMBOL|C||"RSD"|
45 |2|DISCOUNT_RT|N|0.5||
46 |2|DISCOUNT_RT|N|0.4||
47 |2|CURRENCY_SYMBOL|C||"EUR"|
48 |2|CURRENCY_SYMBOL|C||"HKD"|
49
50 <h4> SAS Macros </h4>
51 @li dc_assignlib.sas
52 @li mf_getuniquename.sas
53 @li mp_abort.sas
54 @li mp_validatecol.sas
55
56 @sasjslint {"maxLineLength": 95}
57
58**/
59
60/* send back the raw and formatted values */
61%let tgtlibds=0;
62%let varlibds=%mf_getuniquename();
63%let vartgtlibds=%mf_getuniquename();
64%let var_is_libds=%mf_getuniquename();
65
66data _null_;
67 length xl_libref base_lib select_lib rls_libref cls_libref libref $8
68 xl_table base_ds select_ds rls_table cls_table dsn $32;
69 if _n_=1 then call missing(of _all_);
70 set work.source_row;
71 &varlibds=symget('libds');
72 if &varlibds="&mpelib..MPE_EXCEL_CONFIG"
73 then &vartgtlibds=cats(xl_libref,'.',xl_table);
74 else if &varlibds="&mpelib..MPE_VALIDATIONS"
75 then &vartgtlibds=cats(BASE_LIB,'.',BASE_DS);
76 else if &varlibds="&mpelib..MPE_SELECTBOX"
77 then &vartgtlibds=cats(select_lib,'.',select_ds);
78 else if &varlibds="&mpelib..MPE_ROW_LEVEL_SECURITY"
79 then &vartgtlibds=cats(RLS_LIBREF,'.',RLS_TABLE);
80 else if &varlibds="&mpelib..MPE_COLUMN_LEVEL_SECURITY"
81 then &vartgtlibds=cats(CLS_LIBREF,'.',CLS_TABLE);
82 else if &varlibds="&mpelib..MPE_TABLES"
83 then &vartgtlibds=cats(LIBREF,'.',DSN);
84
85 /* validate libds */
86 %mp_validatecol(&vartgtlibds,LIBDS,&var_is_libds)
87
88 if &var_is_libds=1 then call symputx('tgtlibds',&vartgtlibds);
89 putlog (_all_)(=);
90run;
91
92%mp_abort(iftrue= ("&tgtlibds" ="0" )
93 ,mac=&_program..sas
94 ,msg=%str(Unable to extract libds vars from &libds inputs for &variable_nm)
95)
96
97%dc_assignlib(READ,%scan(&tgtlibds,1,.))
98
99proc contents noprint data=&tgtlibds
100 out=work.DYNAMIC_VALUES (keep=name rename=(name=raw_value) );
101run;
102
103data work.DYNAMIC_VALUES;
104 set work.DYNAMIC_VALUES;
105 format raw_value;
106 raw_value=upcase(raw_value);
107run;
108
109