How to create a user-specific library SASĀ® in Enterprise GuideĀ®


This code assigns a user specific library in Enterprise Guide so that a user who starts Enterprise Guide will get their own library assigned.

  1. Add the code below

    /* +--------------------------------------------------------------------+ | c r e a t e _ u s e r _ d i r . s a s | +--------------------------------------------------------------------+

    Module: create_user_dir.sas
           Version: 1.0
          Function: Assigns a LIBNAME to a user directory and creates it if
    necessary.
             Usage: Include code in server options of Enterprise Guide.
           Authors: Sascha Raeuschel
              Date: 07MAY2007
               SAS: 9.1.3
         Called-by: various autoexec files
     Global-MacVar: newdir (rw) basepath(r)
    */

    %global newdir basepath;

    %************************************************; %* Base path to user direcotry root; %************************************************;

    /* read directory from server */ /* Note: replace <plan_dir> with the actual folder name */

    %include 'c:\sas\<plan_dir>\Lev1\SASMain\MetadataServer\userdir.config';

    %if &SYSSCP!=OS %then %do; /* not for MVS Server */
      data _null_;
        length newdir $256;
        newdir=dcreate("%lowcase(&_EGUSERID)","&basepath");
        call symput ('newdir',newdir);
      run;

    libname %lowcase(&_EGUSERID) "&basepath/&_EGUSERID"; %end; /* not for MVS Server */

    *-------------------------- END OF SOURCE ---------------------------;

    to the EGAuto.sas program file of each user who should get a library directory. EGAuto.sas can be found in the directory of the specific user, where <user> is the user's ID:

    "c:\documents and settings\<user>\Application Data\SAS\Enterprise Guide\4\"

  2. Create a file called userdir.config in the place defined in the first real line of code (Note: replace <plan_dir> with the actual folder name):

    %include 'c:\sas\<plan_dir>\Lev1\SASMain\MetadataServer\userdir.config';

    This file, userdir.config, should reside on the SAS server and just consists of one line of SAS code (axample):

    %let basepath=c:\users;

    The code in userdir.config defines the base path where the user directories will be created on the SAS server (the machine where the workspace server is running). If the base path changes, it is not necessary to change all EGAuto.sas, but to only change the userdir.config file.