As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Tips:Check if a directory exists

From sasCommunity
Jump to: navigation, search

As part of the decommissioning effort for this article/tip has been migrated to

The new home for this article/tip is Check if a directory exists (

This macro returns 1 if the specified directory exists, 0 if not. It takes advantage of the fact that the fexist can check for the existence of both directories and files.

%macro DirExist(dir) ; 
   %LOCAL rc fileref return; 
   %let rc = %sysfunc(filename(fileref,&dir)) ; 
   %if %sysfunc(fexist(&fileref))  %then %let return=1;    
   %else %let return=0;
%mend DirExist;
/* Usage */
option noxwait; /* SAS 8.2 only */
%put %DirExist(C:\Documents and Settings\);
%put %DirExist(aaa); more

....see also

Submitted by Adrien VALLEE. Contact me at my Discussion Page.