mpe_row_level_security_postedit.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Post Edit Hook script for the MPE_ROW_LEVEL_SECURITY table
4  @details Post edit hooks provide additional backend validation for user
5  provided data. The incoming dataset is named `work.staging_ds` and is
6  provided in mpe_loader.sas.
7 
8  Available macro variables:
9  @li DC_LIBREF - The DC control library
10  @li LIBREF - The library of the dataset being edited (is assigned)
11  @li DS - The dataset being edited
12 
13  This validation checks the incoming row_level_security settings to ensure
14  each individual filter is
15 
16  <h4> SAS Macros </h4>
17  @li dc_assignlib.sas
18  @li mp_filtercheck.sas
19 
20  <h4> Related Macros </h4>
21  @li mpe_loader.sas
22 
23 **/
24 
25 
26 /* ignore scope and group for validation */
27 proc sql;
28 create table work.batches as
29  select distinct upcase(rls_libref) as rls_libref,
30  upcase(rls_table) as rls_table,
31  rls_group_logic as group_logic,
32  rls_subgroup_logic as subgroup_logic,
33  rls_subgroup_id as subgroup_id,
34  rls_variable_nm as variable_nm,
35  rls_operator_nm as operator_nm,
36  rls_raw_value as raw_value
37  from work.staging_ds
38  where rls_active=1
39  order by rls_libref, rls_table;
40 
41 %let cnt=0;
42 data _null_;
43  set work.batches;
44  by rls_libref rls_table;
45  putlog (_all_)(=);
46  if last.rls_table then do;
47  x+1;
48  call symputx(cats('libds',x),cats(rls_libref,'.',rls_table));
49  call symputx('cnt',x);
50  end;
51 run;
52 
53 %macro quickloop();
54 %do i=1 %to &cnt;
55  data work.inds&i;
56  set work.batches;
57  if cats(rls_libref,'.',rls_table)="&&libds&i";
58  keep group_logic subgroup_logic subgroup_id variable_nm operator_nm
59  raw_value;
60  run;
61  %dc_assignlib(READ,%scan(&&libds&i,1,.))
62  %mp_filtercheck(work.inds&i
63  ,targetds=&&libds&i
64  ,outds=work.badrecords
65  ,abort=YES
66  )
67 %end;
68 %mend quickloop;
69 
70 %quickloop()