BookmarkSubscribeRSS Feed
Fluorite | Level 6



I want to set environment variables using SAS/config/Lev1/SASApp/appservercontext_env_usermods.bat depending on specific group that logon user belongs to.

I tried to get which groups current user belongs to from metadata as follows.


1. Create program that export user and group information from metadata using %mduextr macro, and create a GetUserGroup.bat that kicks

2. Call GetUserGroup.bat in appservercontext_env_usermods.bat

3. Add if~else statement in appservercontext_env_usermods.bat to switch values that is set to environment variables.


GetUserGroup.bat works properly by itself. In appservercontext_env_usermods.bat "if~else" statement also works properly.
But call GetUserGroup.bat in appservercontext_env_usermods.bat and EG start up workspace server,somehow pre-assined libraries are missing.



if anyone has any idea please advise me.



Super User

Pre-assigned libraries will only work if you use the correct metadata connection, and a server context in metadata that the libraries are assigned to.

[SAS configuration]/Lev1/SASApp/BatchServer/sasbatch.bat does that on its own.


What environment variables are you setting? Wouldn't it be easier to just retrieve a user's group information in the

Jade | Level 19

Do you really need system environment variables, or could global macro values be used to accomplish the same?


If group memberships change not to often, you could create a sas-file per user with the necessary %global-statements and include those in with the statement

%include "/path/&";



Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.


Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 3 in conversation