Macros for SAS Application Developers
https://github.com/sasjs/core
mf_existfeature.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Checks whether a feature exists
4  @details Check to see if a feature is supported in your environment.
5  Run without arguments to see a list of detectable features.
6  Note - this list is based on known versions of SAS rather than
7  actual feature detection, as that is tricky / impossible to do
8  without generating errs in most cases.
9 
10  %put %mf_existfeature(PROCLUA);
11 
12  @param [in] feature The feature to detect.
13 
14  @return output returns 1 or 0 (or -1 if not found)
15 
16  <h4> SAS Macros </h4>
17  @li mf_getplatform.sas
18 
19  @version 8
20  @author Allan Bowe
21 **/
22 /** @cond */
23 %macro mf_existfeature(feature
24 )/*/STORE SOURCE*/;
25  %let feature=%upcase(&feature);
26  %local platform;
27  %let platform=%mf_getplatform();
28 
29  %if &feature= %then %do;
30  %put No feature was requested for detection;
31  %end;
32  %else %if &feature=COLCONSTRAINTS %then %do;
33  %if "%substr(&sysver,1,1)"="4" or "%substr(&sysver,1,1)"="5" %then 0;
34  %else 1;
35  %end;
36  %else %if &feature=PROCLUA %then %do;
37  /* https://blogs.sas.com/content/sasdummy/2015/08/03/using-lua-within-your-sas-programs */
38  %if &platform=SASVIYA %then 1;
39  %else %if "&sysver"="9.2" or "&sysver"="9.3" %then 0;
40  %else %if "&SYSVLONG" < "9.04.01M3" %then 0;
41  %else 1;
42  %end;
43  %else %if &feature=DBMS_MEMTYPE %then %do;
44  /* does dbms_memtype exist in dictionary.tables? */
45  %if "%substr(&sysver,1,1)"="4" or "%substr(&sysver,1,1)"="5" %then 0;
46  %else 1;
47  %end;
48  %else %if &feature=EXPORTXLS %then %do;
49  /* is it possible to PROC EXPORT an excel file? */
50  %if "%substr(&sysver,1,1)"="4" or "%substr(&sysver,1,1)"="5" %then 1;
51  %else %if %sysfunc(sysprod(SAS/ACCESS Interface to PC Files)) = 1 %then 1;
52  %else 0;
53  %end;
54  %else %do;
55  -1
56  %put &sysmacroname: &feature not found;
57  %end;
58 %mend mf_existfeature;
59 /** @endcond */