Search notes:

SAS option: dlcreatedir

With the option dlcreatedir set, a libname statement will create the directory if it does not exist.
However, it will only add one new level to the directory hierarchy, that is, it won't behave like a mkdir -p and add sub-subdirectories.
options nodlcreatedir;
%let dir=%sysfunc(getoption(work))/libDir;
libname ldir "&dir";
/* Log says:
   NOTE: Library LDIR does not exist
*/

options dlcreatedir;
libname ldir "&dir";
/* Log says:
   NOTE: Library LDIR was created.
   NOTE: Libref LDIR was successfully assigned as follows:
         Engine:        V9
         Physical Name: /var/app/sas/work/SAS_work9F6500009AA7_sas.renenyffenegger.ch/libDir
*/
Github repository about-SAS, path: /programming/options/dlcreatedir/create-directory.sas

See also

dcreate
SAS options

Index