/******************* URBAN INSTITUTE MACRO LIBRARY *********************
: DirExist
Macro: Returns 1 if specified folder exists, 0 if it does not exist.
Description
://www.sascommunity.org/wiki/Tips:Check_if_a_directory_exists
Code source is http
: Function
Use
: Peter Tatian
Author
***********************************************************************/
DirExist(
%macro /** Folder pathname **/
dir
);
/*************************** USAGE NOTES *****************************
:
SAMPLE CALLDirExist( K:\Metro\PTatian\UISUG\Uiautos )
%true (1) if folder K:\Metro\PTatian\UISUG\Uiautos exists,
returns false (0) otherwise
*********************************************************************/
/*************************** UPDATE NOTES ****************************
*********************************************************************/
***** ***** ***** MACRO SET UP ***** ***** *****;
%
%local rc fileref return;
***** ***** ***** ERROR CHECKS ***** ***** *****;
%
***** ***** ***** MACRO BODY ***** ***** *****;
%
%let rc = %sysfunc(filename(fileref,&dir)) ;
%if %sysfunc(fexist(&fileref)) %then %let return=1;
%else %let return=0;
&return
***** ***** ***** CLEAN UP ***** ***** *****;
%
%mend DirExist;
/************************ UNCOMMENT TO TEST ***************************
%let r = %DirExist( K:\Metro\PTatian\UISUG\Uiautos );
=&r;
%put r/**********************************************************************/
Check if Directory Exists
Purpose: Returns 1 if specified folder exists, 0 if it does not exist.