LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 17 Apr 2009 12:16:36 -0500
Reply-To:   Joe Matise <snoopy369@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Joe Matise <snoopy369@GMAIL.COM>
Subject:   Re: Checking to see if a directory exists
Comments:   To: Rose Grandy <rose.grandy@abbott.com>
In-Reply-To:   <200904171649.n3HB2Rbq027564@malibu.cc.uga.edu>
Content-Type:   text/plain; charset=ISO-8859-1

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 >


Back to: Top of message | Previous page | Main SAS-L page