BookmarkSubscribeRSS Feed
civelldr
Calcite | Level 5

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!

5 REPLIES 5
data_null__
Jade | Level 19

did you try?

x 'cd c:\temp';

nathan_owens
Obsidian | Level 7

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"

civelldr
Calcite | Level 5

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.  

Kurt_Bremser
Super User

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

jakarman
Barite | Level 11

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 --<-----

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1942 views
  • 0 likes
  • 5 in conversation