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.
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.
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.
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.
SASUSER will do that, since its a reference to a folder location.
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;
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.
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;
Thanks a lot everyone. It worked!! Like Always!!!
Don't forget to pick an answer.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.