BookmarkSubscribeRSS Feed
Tourmaline | Level 20

When scheduling a job, how is the default source path defined and how can it be changed?




SAS Employee

There is a SAS metadata directory object associated with the application server context. This is where the default path comes from.



It doesn't appear to be something exposed through the user interface (SMC). I'm not sure its a good idea to change it.


EDIT: You can update it inside the Schedule Manager plugin inside SMC. You right click the plugin, click "Deployment Directories". You get a UI to view this metadata and update it.

SAS Employee

Just noticed you are talking about the browse for source code button, not the deployment directories. This uses the file service offered by the SAS Workspace Server. The schedule manager plugin does not include an override for where to start this search from, its using the default path of the file service. On Linux it looks like this path defaults to $HOME, on Windows %MYSASFILES%.

Tourmaline | Level 20

Hi Simon,

Changing %mysasfiles% doesn't change the default source path.

It always seems to point to the path of library SASUSER, which makes no sense at all.

Cheers, Christian

SAS Employee
There is a IOM method driving this file chooser is the ListFiles method offered from the FileService. See

The doc is brief but you get a rough idea what the developer has to work with. The difficulty for both the Workspace Server developers and also the Schedule Manager plugin developer is what is a valid path to start with? The plugin in the management console leaves the path argument empty to leave it to the service to return some valid location to start with. When the workspace server starts and this service is leveraged it has to return a valid path and files. I mentioned %MYSASFILES% was the default because it lined up in my lab. I don't actually know what the workspace server developers pick when path is an empty string but you can imagine the challenge.

If you had to build a file chooser to select files on the SAS server how would you decide a valid filesystem location to start browsing?
SAS Employee

Kept code spelunking for you. The file service has a special flag you pass it to tell the service that you want the contents of the users home. The "ListFilesModeUser" flag is what is used in the schedule manager plugin to start the navigation at the users home. Sensible so far.


The file service uses some other code to find the home directory of the user. There are different implementations for the various operating systems. On Windows the function to find the users home directory looks up the shell variable SASUSER and returns this path, if its unset the current working directory of the process is used. Not entirely sure why its done like this but  I guess the reasoning is that SASUSER is 99.99% of the time in the users "My Documents" folder on Windows by virtue of using the result of the Windows SHGetKnownFolderPath function for FOLDERID_Documents at startup because of the default value of SASUSER is set like this: -SASUSER "?FOLDERID_Documents\My SAS Files\9.4".  On Linux/UNIX the ~ path is expanded and used.

You could change the default path by setting the Windows shell variable SASUSER to some other path. It not advisable, good chance that breaks stuff in your SAS session. Many places in SAS (and user written code) likely assume the shell variable SASUSER references the filesystem location of the SASUSER library.

If this is causing huge amounts of pain then give me a call tomorrow, or when you are free and we can talk about this. I'm sure we can find an elegant solution to whatever is causing you problems.

Tourmaline | Level 20

No worries Simon. You have already spent too much time on this.

I was just hoping that users who want to schedule jobs don't have to navigate.

We are using service accounts for scheduling.

The SASUSER env var was not defined so I defined it in the registry and it worked.

1          %put  &sysuserid;
3          filename CMD pipe 'set | find "SASU"';
4          data T;
5            infile CMD;
6            input;
7            put _infile_;
8          run;

NOTE: Compression was disabled for data set WORK.T because compression overhead would increase the size of the data set.
NOTE: The infile CMD is:
      Unnamed Pipe Access Device,
      PROCESS=set | find "SASU",RECFM=V,LRECL=32767

NOTE: 1 record was read from the infile CMD.
      The minimum record length was 28.
      The maximum record length was 28.

But the default path for deployment is still the same


That's fine, users will have to click and navigate to their folder on drive F: for now.
I had to try but the cost/benefit of this exercise is getting too high. 🙂

Thank you again for your thorough investigation!

Tourmaline | Level 20

MYSASFILES also points to F: btw, but the deployment default path seems hard to repoint.

No worries, we tried 🙂

Thanks again!!

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

CLI in SAS Viya

Learn how to install the SAS Viya CLI and a few commands you may find useful in this video by SAS’ Darrell Barton.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 2 in conversation