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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 3057 views
  • 0 likes
  • 6 in conversation