Loading...
Searching...
No Matches
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 Hook scripts run inside the service that includes them, so the macros
15 they call are already in that session. They are listed as ignored rather
16 than declared, so the script keeps no macro list of its own to maintain.
17
18 @sasjslint {"ignoredMacros": ["mp_abort"]}
19
20**/
21
22%let abort=0;
23%let errmsg=;
24
25data work.staging_ds;
26 set work.staging_ds;
27 length errmsg $1000;
28 drop err:;
29 /* KM1 validations */
30 if XLMAP_ID='BASEL-KM1' then do;
31 if XLMAP_RANGE_ID='KM1:a' & input(value_txt,8.)<100 then do;
32 errmsg='Should be greater than 100';
33 err=1;
34 end;
35 end;
36 /* CR2 Validations */
37 if XLMAP_ID='BASEL-CR2' then do;
38 if XLMAP_RANGE_ID='CR2-sec1' & row_no=3 & input(value_txt,8.)>0 then do;
39 errmsg='Should be negative';
40 err=1;
41 end;
42 end;
43
44 /* publish abort message */
45 if err=1 then do;
46 errmsg=catx(' ',xlmap_range_id,':',value_txt,'->',errmsg);
47 call symputx('errmsg',errmsg);
48 call symputx('abort',1);
49 end;
50run;
51
52%mp_abort(iftrue=(&abort ne 0)
53 ,mac=xlmap_data_postedit
54 ,msg=%superq(errmsg)
55)