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 (May 2007, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 8 May 2007 16:03:22 -0400
Reply-To:     Lorne Klassen <lk1@ROGERS.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Lorne Klassen <lk1@ROGERS.COM>
Subject:      Check if a file exists in concatented aggregate fileref

SAS 9.1, Windows XP

I want to check if a file exists in a folder. If the fileref for my folder is a fileref pointing to a *single* folder then this works:

filename xxx "c:\a";

/*************************************************************************/ /* Assign a sys generated fileref to the file x2.txt in the folder c:\a */ /*************************************************************************/ %let tempfref = ; %let rc = %SYSFUNC(FILENAME(tempfref,x2.txt,DISK,,xxx));

/***********************************/ /* Check if the file x2.txt exists */ /* THIS WORKS FINE */ /***********************************/ %let exist = %SYSFUNC(FEXIST(&tempfref)); %put &exist;

HOWEVER......

If the aggregate fileref is a fileref of concatenated folders then this does not work:

filename xxx ("c:\a", "c:\b", "c:\c");

/**************************************************************/ /* Assign a sys generated fileref to the file x2.txt in <xxx> */ /**************************************************************/ %let tempfref = ; %let rc = %SYSFUNC(FILENAME(tempfref,x2.txt,DISK,,xxx));

/****************************************************************/ /* This time FEXIST always returns 1, even if the file does not */ /* exist in any of the 3 folders */ /****************************************************************/ %let exist = %SYSFUNC(FEXIST(&tempfref)); %put &exist;

Note: Using tempfref to read from x2.txt works

Does anyone know how to check if x2.txt exists in the concatenated fileref xxx (i.e. in one or more of the three folders)?


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