Date: Tue, 27 Mar 2012 08:57:21 -0700
Reply-To: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Subject: Re: Is it possible to chang work lib with options statement?
In-Reply-To: <932975BB32CE054396E810CFB7AB35881834299F01@VA3DIAXVS3A1.RED001.local>
Content-Type: text/plain; charset="us-ascii"
Hi Ya,
First I would start by saying we should ignore
any misconception of "totally different default
WORK libname". Let's take a moment to clarify.
Let's remember that the involvements here are
very straightforward and very simple. We just
need to remind ourselves of two simple aspects.
First, all datasets that get written out want to
go to some destination. That destination folder
is whereever the libref points to or if no libref,
it goes to whereever the internal pre-prepared
no-libref libref is pointing to. It just happens
that the default at startup assigns the no-libref
to a pre-prepared WORK libref.
Just like you can reassign any of your libref
tokens using a LIBNAME statement, the internal
no-libref libref can be overwritten with the
OPTIONS USER=xxx; so no differences here at all.
Secondly, there just happens to be an extra feature
of the pre-prepared WORK library(folder) in that
when your session ends the WORK library(folder) is
cleaned up and your datasets in WORK go poof. All
of your other librefs do not get cleaned up which
merely means those are permanent storage.
Now, to get back to your question. We know the best
solution is the best fit for the "needs". So now that
you have introduced another fine-tuned spec to your
needs we can actually apply the better-fitting of the
two possible approaches we have talked about so far.
You newly infer that you may wish to switch back-n-forth
from permanent storage to the temp folder that
automatically gets cleaned up and goes poof afterwards.
So that distinction tells you what you want to use.
Option #1: if you want to switch back-n-forth between
two or more permanent storage areas, then you want to
use a commmon libref token that you can reassign to the
different destinations. So use your common libref token
on all datasets you destine for these destinations.
Option #2: if you want to switch between permanent
storage and automatic-cleanup storage then you can use
the OPTION USER=xxx to toggle the nolibref between
permanent storage folders and the pre-assigned WORK
folder that automatically goes poof. So do not use
a libref on the dataset so that the default gets used
and you merely repoint that default.
Hope this is helpful.
Mark Terjeson
Investment Business Intelligence
Investment Management & Research
Russell Investments
206-505-2367
Russell
Global Leaders in Multi-Manager Investing
-----Original Message-----
From: Huang, Ya [mailto:Ya.Huang@amylin.com]
Sent: Tuesday, March 27, 2012 8:37 AM
To: Terjeson, Mark; SAS-L@LISTSERV.UGA.EDU
Subject: RE: Is it possible to chang work lib with options statement?
Hi Mark,
Thanks. Will it behave the same as the totally different "default" WORK libname?
I'm not too concerned about the temp datasets, but the other kind of
SAS temp files. I can see temp folder being created and delete under
the default WORK folder such as this:
SAS_util000100001210_n-yhuang
Will it be automatically switched too?
Ya
-----Original Message-----
From: Terjeson, Mark [mailto:Mterjeson@russell.com]
Sent: Tuesday, March 27, 2012 8:10 AM
To: Huang, Ya; SAS-L@LISTSERV.UGA.EDU
Subject: RE: Is it possible to chang work lib with options statement?
Hi Ya,
For that scenario I think I would not rely
on the "default"(no libref). I would use a
libref token that you can merely reassign
locations to at will. I see that Ron has
the same idea.
Mark
-----Original Message-----
From: Huang, Ya [mailto:Ya.Huang@amylin.com]
Sent: Monday, March 26, 2012 3:40 PM
To: Terjeson, Mark; SAS-L@LISTSERV.UGA.EDU
Subject: RE: Is it possible to chang work lib with options statement?
Mark,
What I wanted is to somehow switch in the middle of SAS session, so that
all temp datesets used for data manipulation, generated by myself or
SAS, and anything like temp datasets, such as temp style item store,
temp catalog etc., will be in a different network drive folder after switch.
For example when SAS starts, the work is in
C:\WINDOWS\Temp\SAS Temporary Files\_TD4828
In there, many temp datasets were created, deleted, etc.
Then I want to switch to:
X:\temp\_TD4829 (or something like that, which should be decided by SAS)
Then I will do all the processing again, and compare what the effect of
different temp folder to the overall performance. One being the local physical hard drive
and another one is network drive.
I guess I can run the code twice, each time with different invocation
parameters.
Ya
-----Original Message-----
From: Terjeson, Mark [mailto:Mterjeson@russell.com]
Sent: Monday, March 26, 2012 3:17 PM
To: Huang, Ya; SAS-L@LISTSERV.UGA.EDU
Subject: RE: Is it possible to chang work lib with options statement?
Hi Ya,
Are you asking if the actual path the work lib
is pointing to? or asking if the default lib
for datasets not having a libref can be changed?
The later can be handled with the USER= option.
* write to original WORK lib ;
data abc;
set sashelp.class;
run;
libname alt 'X:\myfolder';
options user=alt; * repoint default to alt ;
* write to X:\myfolder ;
data def;
set sashelp.class;
run;
options user=work; * repoint default back to work ;
* write to original WORK lib ;
data xyz;
set sashelp.class;
run;
Hope this is helpful.
Mark Terjeson
Investment Business Intelligence
Investment Management & Research
Russell Investments
206-505-2367
Russell
Global Leaders in Multi-Manager Investing
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Ya Huang
Sent: Monday, March 26, 2012 2:53 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Is it possible to chang work lib with options statement?
Hi there,
As far as I know, we can change the work folder by editing
the config file or add options in the command line when invoking
sas. I wonder if it can be done when SAS session is up by changing the
options statement.
Thanks
Ya