Desktop productivity for business analysts and programmers

Sas Server: Changing default location where x commands are executed

Reply
New Contributor
Posts: 2

Sas Server: Changing default location where x commands are executed

Hi all, apologies if this has been discussed, but a search didn't turn up any leads.  We have the x command authorized on our SAS server and currently trying to understand how SAS is setting the default location -- it's almost like how you would specify a 'start in..' location when running a batch program.  Right now if I fire up EG and run:  x "mkdir testdir"; this directory will be created in C:\SAS\SASConfig\Lev1\SASApp On the server.  Would love it if this default location could be c:\temp, for instance.  any help much appreciated!

Respected Advisor
Posts: 3,775

Re: Sas Server: Changing default location where x commands are executed

did you try?

x 'cd c:\temp';

Occasional Contributor
Posts: 12

Re: Sas Server: Changing default location where x commands are executed

If you right click on the icon that opens the program, and select properties, you can look for the full target that the program opens under.  If you were to add the following option

it will change the work folder location, and x commands will default to this location as well.

-work "C:\temp"

New Contributor
Posts: 2

Re: Sas Server: Changing default location where x commands are executed

thank you both for your responses -- yes, the x 'cd c:\temp' works but then it requires someone including this prior to creating files in a place they shouldn't.  That might be a temporary work around as an item in the autoexec, however the default behavior is what I'm trying to adjust.  Also the issue here is that our EG runs on our PC clients and connects to SAS on the server, so this seems to be a server setting.  The WORK and SASUSER directors are being created with no problems, and they're different from the default location where the x commands are executed.  

Esteemed Advisor
Posts: 6,685

Re: Sas Server: Changing default location where x commands are executed

You have to keep in mind that X 'cd ....'; will not change the working directory of the SAS workspace server, but the working directory of the shell that the workspace server invokes to execute what was given to the X statement. Once this is complete, the shell terminates and the cd is history.

If you need to change to a directory in order to execute something there, you need to do it in one action:

X 'cd xxxx;do-whatever-you-need-to-do';

That way do-whatever-you-need-to-do actually runs in xxxx.

IMO also it is a design flaw that SAS does not (per default) change to the user's home directory before invoking the workspace server

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Valued Guide
Posts: 3,206

Re: Sas Server: Changing default location where x commands are executed

Known design flaw of SAS. See: 50345 - Changing the current working directory for the SAS® Workspace Server

Ask you platform admin to correct it as indicated by this note. The description is voor Unix translation to Windows is easy.

---->-- ja karman --<-----
Ask a Question
Discussion stats
  • 5 replies
  • 313 views
  • 0 likes
  • 5 in conversation