BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
dodger
Fluorite | Level 6

Hi,

 

Can someone help me on how to redirect sas work library location on unix / AIX environment. There is a default work library location which gets assigned for every SAS session when we open it but I want to change and use the specific directory as a work library for my sas session through rsubmit way.

 

I know the command line solution for the same "nohup sas -work /dir/01 program.sas &" but I want to know how to do the same thing using rsubmit in a sas session.

 

Basically I want to redirect work library files to a permenant library when running codes using SAS session and rsubmit. I'm ok deleting those files manually later.

 

Thanks a lot.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

If you mean that you can use one level names and data goes to or is read from that location then then you may be able to use the USER option.

 

Options user="library-specification"

 

but I have never tried this with anything resembling rsubmit.

 

You would have to explicitly reference the WORK library for anything there. The USER option does not clean up at the end of a session.

View solution in original post

8 REPLIES 8
ballardw
Super User

If you mean that you can use one level names and data goes to or is read from that location then then you may be able to use the USER option.

 

Options user="library-specification"

 

but I have never tried this with anything resembling rsubmit.

 

You would have to explicitly reference the WORK library for anything there. The USER option does not clean up at the end of a session.

dodger
Fluorite | Level 6

Thanks you...Basically I want to redirect work library files to a permenant library when running codes using SAS session and rsubmit. I'm ok deleting those files manually later.

Reeza
Super User

SASUSER will do that, since its a reference to a folder location.

 

 

Reeza
Super User

If you create a sasuser library all one level tables will be assigned there. 

 

Rsubmit;

libname sasuser 'path to folder';

 

data class;

set sashelp.class;

run;

 

proc datasets library = sasuser;

run;quit;

 

endrsubmit;

Tom
Super User Tom
Super User

Creating a USER library might be the easiest thing since redirecting WORK would require changing the option when SAS started. You can just create a new library with the libref of USER.  Or you could use the USER option to specify another libref to use instead.

signon;
rsubmit;
libname user '/myfiles';
data xxx;
 set sashelp.class;
run;
endrsubmit;

But you need to use single level names for your "work" datasets.  If you reference XXX then SAS will see it as USER.XXX, but if you reference WORK.XXX then it will still go to the WORK directory.

Kurt_Bremser
Super User

WORK is always pointing to directory that is created when a SAS session starts and removed when the session ends.

Either change the library of your datasets to a permanent one, or use proc copy to copy datasets from WORK to another (permanent) library.

You might consider doing this to automate it for testing:

libname somelib 'path_to_permanent_location');

data _null_;
if "&runtype" = "TEST"
then call symput('work','somelib');
else call symput('work','work');
run;

data &work..your_dataset;
.
.
.
run;
 
dodger
Fluorite | Level 6

Thanks a lot everyone. It worked!! Like Always!!!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 3076 views
  • 0 likes
  • 6 in conversation