I am getting a note in the log
when I run the below macro
%cr_root_sub_dir(maindir='~/practice_exer/Mth_Rep',subdir='APR2016');
The macro code is :
%macro cr_root_sub_dir(maindir,subdir);
%put _local_;
%if &maindir = %then
%do;
%put 'Root directory is blank';
%goto exit;
%end;
%else
%do;
%if %sysfunc(fexist(&maindir)) %then
%put 'Directory &maindir Already Exists';
%else
%do;
%let newdir = %sysfunc(dcreate(&maindir,'~'));
%let newsubdir = %sysfunc(dcreate(&subdir,&maindir));
%end;
%end;
%exit:;
%mend cr_root_sub_dir;
@pambardar I hope this worked for you. In any case please let me know and please consider accepting my solution.
- Jan.
fexist() takes a fileref as argument. What you provieded was a filename. Assign a fileref using filename statement or use filexist() instead of fexist().
Regards,
- Jan.
I meant FILEEXiST() of course. Two e's.
@pambardar I hope this worked for you. In any case please let me know and please consider accepting my solution.
- Jan.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.