-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathqsysget.sas
25 lines (22 loc) · 1.02 KB
/
qsysget.sas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
%macro qsysget
/*----------------------------------------------------------------------
Get macro quoted value of enviroment variable
----------------------------------------------------------------------*/
(name /* Name of environment variable */
);
/*----------------------------------------------------------------------
Returns the macro quoted value of the named environment variable.
The macro function %SYSGET() does not mask macro triggers. This can
cause issues when the value of the environment variable contains
special characters like: & % ;
This macro uses the %QSYSFUNC() macro function to call the regular
SAS function SYSGET() instead so macro quoting is applied.
The SYSRC global macro variable is set to indicate whether the
environment variable was found.
1 = Environment variable not found.
0 = Environment variable found.
----------------------------------------------------------------------*/
%let sysrc=0;
%if -1=%sysfunc(envlen(&name)) %then %let sysrc=1;
%else %qsysfunc(sysget(&name));
%mend qsysget;