sample_xlmap_data_postedit.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Sample XLMAP Data hook program
4  @details This hook script should NOT be modified in place, as the changes
5  would be lost in your next Data Controller deployment.
6  Instead, create a copy of this hook script and place it OUTSIDE the
7  Data Controller metadata folder.
8 
9  Available macro variables:
10  @li DC_LIBREF - The DC control library
11  @li LIBREF - The library of the dataset being edited (is assigned)
12  @li DS - The target dataset being loaded
13 
14 **/
15 
16 %let abort=0;
17 %let errmsg=;
18 
19 data work.staging_ds;
20  set work.staging_ds;
21  length errmsg $1000;
22  drop err:;
23  /* KM1 validations */
24  if XLMAP_ID='BASEL-KM1' then do;
25  if XLMAP_RANGE_ID='KM1:a' & input(value_txt,8.)<100 then do;
26  errmsg='Should be greater than 100';
27  err=1;
28  end;
29  end;
30  /* CR2 Validations */
31  if XLMAP_ID='BASEL-CR2' then do;
32  if XLMAP_RANGE_ID='CR2-sec1' & row_no=3 & input(value_txt,8.)>0 then do;
33  errmsg='Should be negative';
34  err=1;
35  end;
36  end;
37 
38  /* publish error message */
39  if err=1 then do;
40  errmsg=catx(' ',xlmap_range_id,':',value_txt,'->',errmsg);
41  call symputx('errmsg',errmsg);
42  call symputx('abort',1);
43  end;
44 run;
45 
46 %mp_abort(iftrue=(&abort ne 0)
47  ,mac=xlmap_data_postedit
48  ,msg=%superq(errmsg)
49 )