|
Use FILEEXIST.
From the SAS documentation:
%if %sysfunc(fileexist(&myfilerf)) %then
(do whatever)
so
%macro assignlib(libref,libnm);
%if %sysfunc(fileexist(&libref)) %then
libname &libnm &libref;
%else
%put Library reference &libref. does not exist.
;
%mend;
%assignlib('c:\joe\',joelib);
should work, or something along those lines.
-Joe
On Fri, Apr 17, 2009 at 11:49 AM, Rose Grandy <rose.grandy@abbott.com>wrote:
> I am trying to find a really simple way to check to see if a directory
> exists before I use it in a libname statement. I'd like to avoid using an x
> comand to get a directory or using a filename/pipe. I am running in PC-
> SAS. I am sure there is one but I haven't found it. Could someone offer a
> suggestion?
>
> Thanks
>
> Rose
>
|