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 one of:
9 
10  @li SASMETA
11  @li SASVIYA
12  @li SASJS
13  @li BASESAS
14 
15  @param [in] switch the param for which to return a platform specific variable
16 
17  <h4> SAS Macros </h4>
18  @li mf_mval.sas
19  @li mf_trimstr.sas
20 
21  @version 9.4 / 3.4
22  @author Allan Bowe
23 **/
24 
25 %macro mf_getplatform(switch
26 )/*/STORE SOURCE*/;
27 %local a b c;
28 %if &switch.NONE=NONE %then %do;
29  %if %symexist(sasjsprocessmode) %then %do;
30  %if &sasjsprocessmode=Stored Program %then %do;
31  SASJS
32  %return;
33  %end;
34  %end;
35  %if %symexist(sysprocessmode) %then %do;
36  %if "&sysprocessmode"="SAS Object Server"
37  or "&sysprocessmode"= "SAS Compute Server" %then %do;
38  SASVIYA
39  %end;
40  %else %if "&sysprocessmode"="SAS Stored Process Server"
41  or "&sysprocessmode"="SAS Workspace Server"
42  %then %do;
43  SASMETA
44  %return;
45  %end;
46  %else %do;
47  BASESAS
48  %return;
49  %end;
50  %end;
51  %else %if %symexist(_metaport) or %symexist(_metauser) %then %do;
52  SASMETA
53  %return;
54  %end;
55  %else %do;
56  BASESAS
57  %return;
58  %end;
59 %end;
60 %else %if &switch=SASSTUDIO %then %do;
61  /* return the version of SAS Studio else 0 */
62  %if %mf_mval(_CLIENTAPP)=%str(SAS Studio) %then %do;
63  %let a=%mf_mval(_CLIENTVERSION);
64  %let b=%scan(&a,1,.);
65  %if %eval(&b >2) %then %do;
66  &b
67  %end;
68  %else 0;
69  %end;
70  %else 0;
71 %end;
72 %else %if &switch=VIYARESTAPI %then %do;
73  %mf_trimstr(%sysfunc(getoption(servicesbaseurl)),/)
74 %end;
75 %mend mf_getplatform;