Loading...
Searching...
No Matches
mpe_validatecol.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Validates a column of values, including the Data Controller
4 format-catalog form of a libds reference
5 @details Wrapper around mp_validatecol() that adds the Data Controller
6 convention of addressing a format catalog as `LIBREF.CATALOGNAME-FC`
7 to the LIBDS rule.
8
9 The `-FC` suffix is matched exactly and the remainder is validated as
10 a strict LIBREF.DATASET, so the *whole* value is covered by the
11 validation - a bare scan on the dash would leave anything after it
12 unvalidated. The input column itself is never modified, so a caller
13 that needs the catalog reference downstream (to match MPE_SECURITY,
14 for instance) still receives it.
15
16 @param [in] incol Input column (a data step variable)
17 @param [in] rule Validation rule, as per mp_validatecol()
18 @param [out] outcol 1 when the value is valid, else 0
19
20 <h4> SAS Macros </h4>
21 @li mp_validatecol.sas
22 @li mf_getuniquename.sas
23
24 @version 9.2
25 @author 4GL Apps Ltd
26 @copyright 4GL Apps Ltd. This code may only be used within Data Controller
27 and may not be re-distributed or re-sold without the express permission of
28 4GL Apps Ltd.
29**/
30
31%macro mpe_validatecol(incol,rule,outcol);
32
33%if &rule=LIBDS %then %do;
34 /* tempcol is given a unique name with every invocation */
35 %local tempcol;
36 %let tempcol=%mf_getuniquename(prefix=cat);
37 &tempcol=strip(&incol);
38 /* permit the format-catalog form: LIBREF.CATALOGNAME-FC, exactly */
39 if length(&tempcol)>3
40 and upcase(substr(&tempcol,length(&tempcol)-2,3))='-FC'
41 then &tempcol=substr(&tempcol,1,length(&tempcol)-3);
42 %mp_validatecol(&tempcol,LIBDS,&outcol)
43 drop &tempcol;
44%end;
45%else %mp_validatecol(&incol,&rule,&outcol);
46
47%mend mpe_validatecol;