Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SAS - Create new libraries nested inside WORK

Tags:

sas

tl;dr: Can SAS libraries be nested within one another in the Enhanced Editor Explorer?

I am working with code which generates a plethora of data sets. Although there are many individual data sets, they can be grouped into various categories. For instance, perhaps 30 of them are incoming "raw" data, another 50 are analysis "results" and the remaining 20 are "intermediate" steps.

Currently, all 100 data sets reside in the Work directory. They have been well named so that they appear next to one another in the SAS Explorer window. However, I would prefer to organize them in folders.

One way to do this is to create new directories within the temporary Work folder.

%let dirWORK = %sysfunc(pathname(Work));

options dlcreatedir;

libname raw     "&dirWORK./raw";
libname interm  "&dirWORK./intermediate";
libname results "&dirWORK./results";

As sub-directories of Work, these directories and their contents will be deleted when the session ends. This is agreeable.

Not agreeable is how the raw, iterm, and results libraries appear one level up in 'Active Libraries' instead of within the 'Contents of "Work"'. This behavior is somewhat counter-intuitive and awkward.

  • Is there a way to view the sub-folders of Work within the 'Contents of "Work"' in the SAS Explorer?
  • Perhaps there's another way to separate the data sets (DCREATE?) which causes the Explorer window to behave like a typical file browser?
like image 955
Lorem Ipsum Avatar asked Sep 17 '26 13:09

Lorem Ipsum


1 Answers

Libraries can contain many things.. But not other libraries. Your 'Active Libraries' will always show your (available) list of libraries at the same level, regardless of where or how they were defined:

enter image description here

One option if you'd like to view your datasets like a typical file browser is to use the Explorer window. Just click View / Explorer, and navigate to your datasets that way..

eg:

%let dirWORK =C:/temp/work;
options dlcreatedir;
libname raw     "&dirWORK./raw";
libname interm  "&dirWORK./intermediate";
libname results "&dirWORK./results";

data raw.test;
set sashelp.class;
run;

enter image description here

like image 166
Allan Bowe Avatar answered Sep 22 '26 00:09

Allan Bowe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!