18 %local lastchar child parent;
20 %let lastchar = %substr(&dir, %length(&dir));
21 %
if (%bquote(&lastchar) eq %str(:)) %then %
do;
26 %
if (%bquote(&lastchar)=%str(/)) or (%bquote(&lastchar)=%str(\)) %then %
do;
28 %
if (%length(&dir) eq 1) %then %
do;
34 %let dir = %substr(&dir, 1, %length(&dir)-1);
38 %
if (%sysfunc(fileexist(%bquote(&dir))) = 0) %then %
do;
41 %let child = %scan(&dir, -1, %str(/\:));
48 %
if (%length(&dir) gt %length(&child)) %then %
do;
49 %let parent = %substr(&dir, 1, %length(&dir)-%length(&child));
57 %let dname = %sysfunc(dcreate(&child, &parent));
58 %
if (%bquote(&dname) eq ) %then %
do;
59 %put ERROR: could not create &parent + &child;
63 %put Directory created: &dir;