Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
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 @sasjslint {"maxLineLength": 94}
22**/
23/** @cond */
24%macro mf_existfeature(feature
25)/*/STORE SOURCE*/;
26 %let feature=%upcase(&feature);
27 %local platform;
28 %let platform=%mf_getplatform();
29
30 %if &feature= %then %do;
31 %put No feature was requested for detection;
32 %end;
33 %else %if &feature=COLCONSTRAINTS %then %do;
34 %if "%substr(&sysver,1,1)"="4" or "%substr(&sysver,1,1)"="5" %then 0;
35 %else 1;
36 %end;
37 %else %if &feature=PROCLUA %then %do;
38 /* https://blogs.sas.com/content/sasdummy/2015/08/03/using-lua-within-your-sas-programs */
39 %if &platform=SASVIYA %then 1;
40 %else %if "&sysver"="9.2" or "&sysver"="9.3" %then 0;
41 %else %if "&SYSVLONG" < "9.04.01M3" %then 0;
42 %else 1;
43 %end;
44 %else %if &feature=DBMS_MEMTYPE %then %do;
45 /* does dbms_memtype exist in dictionary.tables? */
46 %if "%substr(&sysver,1,1)"="4" or "%substr(&sysver,1,1)"="5" %then 0;
47 %else 1;
48 %end;
49 %else %if &feature=EXPORTXLS %then %do;
50 /* is it possible to PROC EXPORT an excel file? */
51 %if "%substr(&sysver,1,1)"="4" or "%substr(&sysver,1,1)"="5" %then 1;
52 %else %if %sysfunc(sysprod(SAS/ACCESS Interface to PC Files)) = 1 %then 1;
53 %else 0;
54 %end;
55 %else %do;
56 -1
57 %put &sysmacroname: &feature not found;
58 %end;
59%mend mf_existfeature;
60/** @endcond */