BookmarkSubscribeRSS Feed
AsakoOkano
Fluorite | Level 6

Hi

 

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 GetUserGroup.sas program that export user and group information from metadata using %mduextr macro, and create a GetUserGroup.bat that kicks GetUserGroup.sas.

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.

 

thankyou

2 REPLIES 2
Kurt_Bremser
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 autoexec_usermods.sas?

andreas_lds
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 autoexec_usermods.sas with the statement

%include "/path/&SysUserId..sas";

 

sas-innovate-2024.png

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
  • 620 views
  • 0 likes
  • 3 in conversation