Giorgio Spedicato
Giorgio Spedicato

Reputation: 2503

Setting working directory in SAS

I would like to programmatically reallocate SAS work dir within a script. In other words, standard set up is ok, but, for some tasks, I would like to have some lines of code that change the default settings... Just for that session.

Thanks in advance for your attention

Upvotes: 2

Views: 6348

Answers (1)

Reeza
Reeza

Reputation: 21264

Use a library called user. When this library is present, sas defaults all datasets to the user library instead of the work library.

libname user '/folders/myfolders/proj1';

data want;
set sashelp.class;
run;

proc datasets library=user;
run;quit;

The User library enables you to read, create, and write to files in a SAS library other than Work without specifying a libref as part of the SAS filename. Once you associate the libref User with a SAS library, SAS stores any file with a one-level name in that library. Unlike the Work library, files stored in this library are not deleted by SAS when the session terminates.

http://support.sas.com/documentation/cdl/en/lrcon/69852/HTML/default/viewer.htm#n18m1vkqmeo4esn1moikt23zhp8s.htm

Upvotes: 3

Related Questions