LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (March 2012, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 28 Mar 2012 14:15:08 -0400
Reply-To:     Ya Huang <ya.huang@AMYLIN.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ya Huang <ya.huang@AMYLIN.COM>
Subject:      Re: Is it possible to chang work lib with options statement?
Comments: To: Ron Fehd <rjf2@CDC.GOV>

Fot those who might still be interested, I ended up using two different batch runs with the second one pointing to a network drive folder for WORK ( eg. -work "s:\xxx\xxx"). Here is how the performance differ:

Run on my laptop with all default setting (W7/V9.2M0):

real time 6:41.31 cpu time 6:39.14

Run on my laptop with WORK pointing to a network drive folder:

real time 19:32.74 cpu time 8:22.35

Note this is a CPU bound job, as you can see, the first run real time and cpu time almost same, as expected. Second run real time much longer, my interpretation is that even though it is a cpu bound job, it still need once a while swap data between cpu and temp disk folder, since this time it is a network drive, not a local hard drive, it need more time to cross the network. I did not expect to see this big jump of the real time though, neither did I expect so see the cpu time go up this much.

Ya

On Tue, 27 Mar 2012 19:39:38 +0000, Fehd, Ronald J. (CDC/OCOO/ITSO) <rjf2@CDC.GOV> wrote:

><applause> %-) > >> -----Original Message----- >> From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu] >> On Behalf Of Terjeson, Mark >> Sent: Tuesday, March 27, 2012 12:49 PM >> To: SAS-L@LISTSERV.UGA.EDU >> Subject: RE: Is it possible to chang work lib with options statement? >> >> Hi, >> >> For those still a little confused about the term "permanent" storage, and >> confused about the USER= option, or those still new to SAS, we can expound >> a little more. >> >> I've seen newbies nervously ponder the word permanent. "Permanent" >> storage merely refers to saved files that are allowed to stay in the >> directory/folder after the program is over. >> Certainly they can subsequently be moved or deleted. Temporary storage >> merely refers to saved files that go poof after the program is over(i.e. >> automatic cleanup). >> >> We can describe the use of the USER= option pictorally. >> >> Most folks new to SAS have grasped that you can put a libref token on the >> front of a dataset name and that dataset will be stored at the location that >> libref refers to. >> e.g. >> libname libref1 '/folder1'; >> libname libref2 '/folder2'; >> data libref1.mydataset1; >> a=1; >> run; >> data libref2.mydataset2; >> a=2; >> run; >> >> and mydataset1 will be in /folder1 >> and mydataset2 will be in /folder2 >> >> They also have learned that not putting a libref on a dataset name saved the >> dataset to the default temporary WORK library/folder. >> >> data mydataset1; >> a=1; >> run; >> data mydataset2; >> a=2; >> run; >> >> and both mydataset1 amd mydataset2 will be in the WORK folder. >> >> >> For toggling dataset to different permanent storage use a common libref >> token. >> e.g. >> libname libref '/folder1'; >> data libref.mydataset1; >> a=1; >> run; >> data libref.mydataset2; >> a=2; >> run; >> >> and both mydataset1 amd mydataset2 will be in /folder1. >> >> then if you somehow conditionally reset >> the libref token to a different folder >> e.g. >> libname libref '/folder2'; >> you can then call or fall through the same code >> data libref.mydataset1; >> a=1; >> run; >> data libref.mydataset2; >> a=2; >> run; >> >> and now both mydataset1 amd mydataset2 will be in /folder2. >> >> Most folks feel that they are straightforwardly controlling the destination >> location. >> >> So now on to default libref and the USER= option. >> >> >> Visualize an internal variable that contains the libref to be used when no >> libref tokens are placed in the code. >> e.g. if you have code like >> >> data mydataset1; >> a=1; >> run; >> data mydataset2; >> a=2; >> run; >> >> as you see there is no libref token, just the dataset name only. Most folks >> think these automatically go to the WORK library/folder, and they would be >> correct, however lets expand this. >> >> Visualize that internal variable that contains the libref to use when no libref >> is specified. >> >> libref to use >> +-------------------+ >> | WORK | >> +-------------------+ >> >> now when no libref is specified, SAS will go to this variable a fetch the >> default or content that is stored here. SAS defaults this to "WORK". >> >> so your code >> data mydataset1; >> is interpreted to be the same as >> data WORK.mydataset1; >> >> Remember, when SAS starts it executes a >> LIBNAME WORK '</my temporary folder location>'; >> >> Back to our internal variable, consider that this container is called USER >> >> libref to use >> +-------------------+ >> USER:| WORK | >> +-------------------+ >> >> So if you want to repoint those >> data mydataset1; >> to go to a different location other than WORK you can, by loading this >> container with a different libref of your choice. >> >> Remember above we had two libname assignments >> libname libref1 '/folder1'; >> libname libref2 '/folder2'; >> >> >> if you want datasets without a libref to go to >> /folder1 you can load the USER container with your libref token for /folder1 >> option user=libref1; >> and now you have >> >> libref to use >> +-------------------+ >> USER:| libref1 | >> +-------------------+ >> >> so when SAS comes across datasets without a libref it still blindly fetches >> the default libref from this USER container. >> >> so your code >> data mydataset1; >> is interpreted to be the same as >> data libref1.mydataset1; >> >> >> you can change USER to libref2 or any other libref you have open. When you >> want to have datasets without a libref to go back to the WORK library/folder, >> merely re-assign it back >> option user=work; >> >> and you are back to >> >> libref to use >> +-------------------+ >> USER:| WORK | >> +-------------------+ >> >> >> So for datasets WITH a libref and datasets WITHOUT a libref, you, the >> programmer, are really in control of the destination in either approach. >> >> Now, you can mix and match to your heart's content. It's all up to your >> imagination now. >> >> >> >> >> 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 >> Terjeson, Mark >> Sent: Tuesday, March 27, 2012 8:57 AM >> To: SAS-L@LISTSERV.UGA.EDU >> Subject: Re: Is it possible to chang work lib with options statement? >> >> 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


Back to: Top of message | Previous page | Main SAS-L page