Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mf_islibds.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Checks whether a string follows correct library.dataset format
4 @details Many macros in the core library accept a library.dataset parameter
5 referred to as 'libds'. This macro validates the structure of that parameter,
6 eg:
7
8 @li 8 character libref?
9 @li 32 character dataset?
10 @li contains a period?
11
12 It does NOT check whether the dataset exists, or if the library is assigned.
13
14 Usage:
15
16 %put %mf_islibds(work.something)=1;
17 %put %mf_islibds(nolib)=0;
18 %put %mf_islibds(badlibref.ds)=0;
19 %put %mf_islibds(w.t.f)=0;
20
21 @param [in] libds The string to be checked
22
23 @return output Returns 1 if libds is valid, 0 if it is not
24
25 <h4> Related Macros </h4>
26 @li mf_islibds.test.sas
27 @li mp_validatecol.sas
28
29 @version 9.2
30**/
31
32%macro mf_islibds(libds
33)/*/STORE SOURCE*/;
34
35%local regex;
36%let regex=%sysfunc(prxparse(%str(/^[_a-z]\w{0,7}\.[_a-z]\w{0,31}$/i)));
37
38%sysfunc(prxmatch(&regex,&libds))
39
40%mend mf_islibds;