09-07-2014 01:08 PM
Need to know the difference between DOPEN and FILEEXIST functions.
My requirement is to check if a directory exist and if it exist then need to read a file in the directory using a data step.
I used FILEEXIST function to fix a bug, in a code where already DOPEN is used to check the directory existance. Can this modify the operation of the code.?
09-07-2014 01:31 PM
Verifies the existence of an external file by its physical name.
Opens a directory, and returns a directory identifier value.
09-07-2014 01:32 PM
FILEEXIST() will check if the path you have provided exists, but it does not tell whether that path is a regular file or a directory.
DOPEN() will attempt to actually open the path as a directory and so will fail if it is instead a regular file.
09-07-2014 01:43 PM
>> My requirement is to check if a directory exist and if it exist then need to read a file in the directory using a data step.
Why not just test if the file exists? If the directory doesn't exist then the file won't exist. And if the file doesn't exist what do you care whether the directory exists or not?