BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
pambardar
Fluorite | Level 6

I am getting a note in the log

"NOTE: In a call to the FEXIST routine, the fileref '~/practice_exer/Mth_Rep' exceeds 8 characters, and will be truncated."

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;

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jklaverstijn
Rhodochrosite | Level 12

@pambardar I hope this worked for you. In any case please let me know and  please consider accepting my solution.

 

- Jan.

View solution in original post

4 REPLIES 4
jklaverstijn
Rhodochrosite | Level 12

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.

jklaverstijn
Rhodochrosite | Level 12

I meant FILEEXiST() of course. Two e's. 

jklaverstijn
Rhodochrosite | Level 12

@pambardar I hope this worked for you. In any case please let me know and  please consider accepting my solution.

 

- Jan.

pambardar
Fluorite | Level 6
Thanks. I tried with assigning fileref and it worked.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 4875 views
  • 7 likes
  • 2 in conversation