How cool would that be! Imagine that you have a need to create a new sub-directory to store data for each run of your code, but don't want to always have to remember to create the directory first 'then' run the code!
Well fear not - there is a SAS Global System Option which will come to your aid.
options dlcreatedir ;
Simply specify the new sub-directory in a LIBNAME statement, and if it does not already exist, then SAS will create it for you and assign the library.
For example, create a timestamped sub-directory with the year and week number:
%let wk = %sysfunc(putn(%sysfunc(today()),weekw5.)) ;
libname mylib "c:\reports\&wk" ;
SAS will dynamically create sub-directories in the form \22W17 \22W18 etc.
N.B. SAS will only create the final component in this directory hierarchy (i.e. the '\reports' directory must already exist).