DATA Step, Macro, Functions and more

How to change the WORK library folder location based on user

Accepted Solution Solved
Reply
Contributor
Posts: 41
Accepted Solution

How to change the WORK library folder location based on user

Hello,

 

I need to change the WORK library folder location based on user. I'm wondering if anyone can help Smiley Happy

 

We installed SAS on a server with roughly 3-5 people accessing the software. My boss wants her Work location to be in C: drive but the rest of the users in H: drive.

 

I opened the SASV9.CFG file but I can't seem to find a way to set the WORK location based on user. The best I could do is to use:

 

-WORK "H:\WORK\!USERNAME"

 

However, all of the data sets are stored in the H: drive.

 

Does anyone have any suggestions?

 

Thanks so much.


Accepted Solutions
Solution
‎04-11-2018 01:39 AM
Contributor
Posts: 41

Re: How to change the WORK library folder location based on user

Posted in reply to andreas_lds

Thanks all! I actually found a solution that I haven't come across on this forum.

 

The Work library path can be set in the SAS properties:

 

test.png

 

 

Looks like this is a good option since we don't have to mess around any cfg or system file.

 

 

View solution in original post


All Replies
Super User
Super User
Posts: 9,210

Re: How to change the WORK library folder location based on user

Why?  Work location is a termporary area only for the current session.  If you need to store outputs/datasets etc. then setup an area and set libnames directly to the store area.  Work is not the place for storing anything other than temporary elements.

Super Contributor
Posts: 320

Re: How to change the WORK library folder location based on user

"My boss wants" is a good enough reason.
Super User
Super User
Posts: 9,210

Re: How to change the WORK library folder location based on user

That depends, are they the best person to decide that, is it inline with company policy, is that secure etc.

"My boss wants me to chuck all these financial papers out of the window" - ok, good enough reason Smiley Surprised)

Super Contributor
Posts: 320

Re: How to change the WORK library folder location based on user

If I have written proof that he asked me to do that and I advised him not to, yes.

Anyway, my answer was tongue in cheek.

Regular Contributor
Posts: 153

Re: How to change the WORK library folder location based on user

[ Edited ]

Hi,

 

  1. Look  for the sasv9.cfg file in your language under Program Files\SASHome\SASFoundation\9.4\nls Directory
  2. Create a copy and edit it
  3. Adapt the line starting with '-WORK' with the path you want as for i.e. "-WORK "!TEMP"
  4. Create a shortcut to SAS and adapt the path to load your edited cfg file:
  5. "C:\Program Files\SASHome\SASFoundation\9.4\sas.exe" -CONFIG "C:\TEMP\sasv9_mod.cfg"
  6. Save the shortcut and start SAS

It will significantly improve the working speed in case your admin set the default work path to a network drive and you remap to your local SSD

________________________

- Cheers -

Contributor
Posts: 41

Re: How to change the WORK library folder location based on user

Thanks Oligolas. So your suggestion is to improve the working speed? I'm hoping to save the working data sets in different folders based on the server user. 

 

E.g.

 

User ABC101 --> C:\Work

Other Users --> H:\Work

 

Do you think that's possible?

 

Regular Contributor
Posts: 153

Re: How to change the WORK library folder location based on user

Hi,

 

afaik you can not change the work path at run time, I would rather work with the SAS libnames and educate the users to use a defined common library.

But you could use a Batch file for loading different shortcuts with different cfg files.

 

 

________________________

- Cheers -

Super User
Posts: 10,612

Re: How to change the WORK library folder location based on user

Using option.

 

options user='c:\temp\';

Regular Contributor
Posts: 153

Re: How to change the WORK library folder location based on user

ehm yeah careful with that, it would save permanently any dataset created at run time which may not be what was wanted, depends on what your boss really intend to do.

 

________________________

- Cheers -

Super Contributor
Posts: 498

Re: How to change the WORK library folder location based on user

The work-location can be set in any cfg-file with

-WORK "path"

SAS will create a sub-folder in the given directory with the name of the user and some more chars to make it unique. Afaik the last use of "-WORK" wins. So you use one "-WORK"-statement in sasv9_usermods.cfg with the default path.

 

With -config statement (in sasv9_usermods.cfg) another cfg-file can be loaded, so you need a cfg-file for each user: empty for those using the default path and with another "-WORK"-statement for your boss. Concatenating the file name in the config-statement didn't work, so we added a SET-statement in appservercontext_env_usermods.bat, like:

SET USER_WORK_CFG=PATH_TO_CFG\%username%.cfg

and used

-config "!USER_WORK_CFG"

in sasv9_usermods.cfg in SASApp directory.

 

I would not allow any user to have work on C-drive of a sas-server without having a very limiting quota management, especially if the config is also stored on C. If the work-datasets fill the available space on C, system-stability could be risked.

Solution
‎04-11-2018 01:39 AM
Contributor
Posts: 41

Re: How to change the WORK library folder location based on user

Posted in reply to andreas_lds

Thanks all! I actually found a solution that I haven't come across on this forum.

 

The Work library path can be set in the SAS properties:

 

test.png

 

 

Looks like this is a good option since we don't have to mess around any cfg or system file.

 

 

Regular Contributor
Posts: 153

Re: How to change the WORK library folder location based on user

Wow that's great thanks for sharing! Apparently any other property can be customized this way Smiley Happy

 

________________________

- Cheers -

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 12 replies
  • 178 views
  • 3 likes
  • 6 in conversation