DATA Step, Macro, Functions and more

redirecting remote sas work library through rsubmit

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 5
Accepted Solution

redirecting remote sas work library through rsubmit

[ Edited ]

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.


Accepted Solutions
Solution
‎08-31-2016 06:43 AM
Super User
Posts: 10,500

Re: redirecting remote sas work library through rsubmit

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


All Replies
Solution
‎08-31-2016 06:43 AM
Super User
Posts: 10,500

Re: redirecting remote sas work library through rsubmit

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.

Occasional Contributor
Posts: 5

Re: redirecting remote sas work library through rsubmit

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.

Super User
Posts: 17,840

Re: redirecting remote sas work library through rsubmit

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

 

 

Super User
Posts: 17,840

Re: redirecting remote sas work library through rsubmit

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;

Super User
Super User
Posts: 6,500

Re: redirecting remote sas work library through rsubmit

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.

Super User
Posts: 6,941

Re: redirecting remote sas work library through rsubmit

[ Edited ]

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;
 
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 5

Re: redirecting remote sas work library through rsubmit

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

PROC Star
Posts: 1,562

Re: redirecting remote sas work library through rsubmit

Don't forget to pick an answer.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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