Production Ready Macros for SAS Application Developers
https://github.com/sasjs/core
mf_getplatform.sas
Go to the documentation of this file.
1/**
2 @file mf_getplatform.sas
3 @brief Returns platform specific variables
4 @details Enables platform specific variables to be returned
5
6 %put %mf_getplatform();
7
8 returns:
9 SASMETA (or SASVIYA)
10
11 @param switch the param for which to return a platform specific variable
12
13 <h4> SAS Macros </h4>
14 @li mf_mval.sas
15 @li mf_trimstr.sas
16
17 @version 9.4 / 3.4
18 @author Allan Bowe
19**/
20
21%macro mf_getplatform(switch
22)/*/STORE SOURCE*/;
23%local a b c;
24%if &switch.NONE=NONE %then %do;
25 %if %symexist(sysprocessmode) %then %do;
26 %if "&sysprocessmode"="SAS Object Server"
27 or "&sysprocessmode"= "SAS Compute Server" %then %do;
28 SASVIYA
29 %end;
30 %else %if "&sysprocessmode"="SAS Stored Process Server"
31 or "&sysprocessmode"="SAS Workspace Server"
32 %then %do;
33 SASMETA
34 %return;
35 %end;
36 %else %do;
37 BASESAS
38 %return;
39 %end;
40 %end;
41 %else %if %symexist(_metaport) or %symexist(_metauser) %then %do;
42 SASMETA
43 %return;
44 %end;
45 %else %do;
46 BASESAS
47 %return;
48 %end;
49%end;
50%else %if &switch=SASSTUDIO %then %do;
51 /* return the version of SAS Studio else 0 */
52 %if %mf_mval(_CLIENTAPP)=%str(SAS Studio) %then %do;
53 %let a=%mf_mval(_CLIENTVERSION);
54 %let b=%scan(&a,1,.);
55 %if %eval(&b >2) %then %do;
56 &b
57 %end;
58 %else 0;
59 %end;
60 %else 0;
61%end;
62%else %if &switch=VIYARESTAPI %then %do;
63 %mf_trimstr(%sysfunc(getoption(servicesbaseurl)),/)
64%end;
65%mend mf_getplatform;