tables_all.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Generic validator for tables in a library
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 
13  <h4> Service Outputs </h4>
14  The values provided below are generic samples - we encourage you to replace
15  these with realistic values in your own deployments.
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.|DISPLAY_VALUE:$|RAW_VALUE|
22  |---|---|---|
23  |1|$77.43|77.43|
24  |2|$88.43|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  |DISPLAY_INDEX:best.|EXTRA_COL_NAME:$32.|DISPLAY_VALUE:$|DISPLAY_TYPE:$1.|RAW_VALUE_NUM|RAW_VALUE_CHAR:$5000|
35  |---|---|---|
36  |1|DISCOUNT_RT|"50%"|N|0.5||
37  |1|DISCOUNT_RT|"40%"|N|0.4||
38  |1|DISCOUNT_RT|"30%"|N|0.3||
39  |1|CURRENCY_SYMBOL|"GBP"|C||"GBP"|
40  |1|CURRENCY_SYMBOL|"RSD"|C||"RSD"|
41  |2|DISCOUNT_RT|"50%"|N|0.5||
42  |2|DISCOUNT_RT|"40%"|N|0.4||
43  |2|CURRENCY_SYMBOL|"EUR"|C||"EUR"|
44  |2|CURRENCY_SYMBOL|"HKD"|C||"HKD"|
45 
46  <h4> SAS Macros </h4>
47  @li dc_assignlib.sas
48 
49 **/
50 
51 /* send back the raw and formatted values */
52 %let tgtlib=0;
53 %let varlibds=%mf_getuniquename();
54 %let vartgtlib=%mf_getuniquename();
55 %let var_is_lib=%mf_getuniquename();
56 data _null_;
57  length &varlibds $41 &vartgtlib $8 libref $8 rls_libref $8;
58  if _n_=1 then call missing(of _all_);
59  set work.source_row;
60  &varlibds=upcase(symget('libds'));
61  if &varlibds="&mpelib..MPE_TABLES" then &vartgtlib=LIBREF;
62  else if &varlibds="&mpelib..MPE_ROW_LEVEL_SECURITY"
63  then &vartgtlib=RLS_LIBREF;
64  else if &varlibds="&mpelib..MPE_COLUMN_LEVEL_SECURITY"
65  then &vartgtlib=CLS_LIBREF;
66 
67  /* validate name */
68  if nvalid(&vartgtlib,'v7') then call symputx('tgtlib',&vartgtlib);
69  call symputx('vartgtlib',&vartgtlib);
70 
71  putlog (_all_)(=);
72 run;
73 
74 %mp_abort(iftrue= ("&tgtlib" ="0" )
75  ,mac=&_program..sas
76  ,msg=%str(Invalid library - %superq(vartgtlib))
77  ,errds=work.dc_error_response
78 )
79 
80 %dc_assignlib(READ,&tgtlib)
81 
82 data members; /* empty table */
83 name=' ';
84 run;
85 ods output Members=Members;
86 proc datasets library=&tgtlib ;
87 run;
88 
89 /* send back the raw and formatted values */
90 proc sql;
91 create table work.DYNAMIC_VALUES as
92  select distinct name as display_value,
93  upcase(name) as raw_value
94  from work.members
95  where MemType='DATA'
96  order by 1;
97