Date: Tue, 7 Oct 2003 10:34:35 -0700
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "David L. Cassell" <cassell.david@EPAMAIL.EPA.GOV>
Subject: Re: x question
Content-type: text/plain; charset=US-ASCII
Richard Groot <spam@RIESENJO.DEMON.NL> wrote:
> How can I change to the default temp directory using windows?
> The next line doesn't work because SAS wil try to resolve a macro.
> All kind of masking facilities do not seem to work either.
> x "cd %temp%";
As others have pointed out, changing this to
x 'cd %temp%';
will mask the '%' from the macro parser.
However, this will *not* solve your problem! In fact, nothing will.
The X command (like the system() function _et_al._) creates a sub-shell
which executes, and then returns to the current SAS job. So you
go to a different shell, change the directory IN THAT SHELL ONLY,
then return to the SAS job, which is still running in the directory
it was in before. You can't change the current environment of a
process by spawning a sub-shell and changing the environment in the
child process. The parent is still unchanged. This is the way things
work in Win32, unix, ...
So a better question is:
What exactly are you trying to do that requires that you change the
working directory to your TEMP directory?
David Cassell, CSC
Senior computing specialist