Macros for SAS Application Developers
https://github.com/sasjs/core
mcf_init.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Sets up the mcf_xx functions
4  @details
5  There is no (efficient) way to determine if an mcf_xx macro has already been
6  invoked. So, we make use of a global macro variable list to keep track.
7 
8  Usage:
9 
10  %mcf_init(MCF_LENGTH)
11 
12  Returns:
13 
14  > 1 (if already initialised) else 0
15 
16  @param [in] func The function to be initialised
17 
18  <h4> Related Macros </h4>
19  @li mcf_init.test.sas
20 
21 **/
22 
23 %macro mcf_init(func
24 )/*/STORE SOURCE*/;
25 
26 %if not (%symexist(SASJS_PREFIX)) %then %do;
27  %global SASJS_PREFIX;
28  %let SASJS_PREFIX=SASJS;
29 %end;
30 
31 %let func=%upcase(&func);
32 
33 /* the / character is just a seperator */
34 %global &sasjs_prefix._FUNCTIONS;
35 %if %index(&&&sasjs_prefix._FUNCTIONS,&func/)>0 %then %do;
36  1
37  %return;
38 %end;
39 %else %do;
40  %let &sasjs_prefix._FUNCTIONS=&&&sasjs_prefix._FUNCTIONS &func/;
41  0
42 %end;
43 
44 %mend mcf_init;