Hi,
I`m trying to read a large text file using infile statement.
When i ran the code, i encountered this error. "ERROR: Physical file does not exist".
I checked the location and see the file is there.
Your help is greatly appreciated.
Thanks,
Saravanan
This error message can result from many situations. While @robby_beum ultimately solved the problem for this specific situation, @ballardw also mentioned one of the most common causes. To close this issue, I will summarize below some likely causes of getting
ERROR: Physical file does not exist.
Please provide the FILENAME statement if used or the INFILE statement.
The most likely problem is a typo in the path or filename, or if using a macro the resolved macro filename or infile has a problem.
Hi, The FILENAME statement is used as given,
filename in "Q:\Data\Original\2010\Decrypted\MDS_Qtr\201204(Apr)\2011Q1\QWU_J67455_P1_Custom.txt" lrecl=1274;
infile in dsd truncover;
The Q: is on server and it is mapped to my computer. This is how it reads,
computer\tmstua(\\sas-2003)(Q:)\Data\Original\2010\Decrypted\MDS_Qtr\201204(Apr)\2011Q1
Thanks
In addition to verifying visually that the file exists in the directory you're referencing, can open and view the file in a text editor?
I'm wondering if the parenthesis in the filename are causing a problem. I've never seen those used before. The only special characters I can recall seeing in a path are the underscore and dash.
I'd say create the exact same directory structure on your C: drive or another mapped drive but without the ( ) characters and copy the file there. Then change the filename statement and see what happens.
Good luck. This is a curious one. Be sure to let us know what you figure out.
The data is too large to be opened in a text editor. I have tried creating the same directory structure in my C: drive and it works perfectly.
Q: drive is on the server and it is mapped to my computer. When i try to access Q:drive, it doesn`t work. I`m baffled.
Thanks.
Very curious. I created a directory on my LAN with (Apr) in the path, put a text file there, created a filename pointing to it, and it worked just fine.
Except that I mistyped the path the first run and it returned the file not exists error. To be sure, I went into Windows Explorer and copied and pasted the directory path and filename into the filename statement. It worked then. Have you done that or did you type it in.
You have a long path and filename, and I see the path has directories for years 2010, 2012, and 2011 in it. Looks confusing. Are those all correct?
Ballardw suggested earlier it's a typo.
To avoid typos i copy pasted the path and file name from windows explorer.
It works fine with same directory structure in other drives except for Q: drive.
I`m not sure why it is not working for Q: drive.
Thanks.
make sure that the file is closed when you run the code, sometimes if the file is open by another program, this may happen
File is closed and it is not used by anyother program. Much appreciated.
maybe there are two many subdirectories?
I had problem to get files from the subdirectories of
"\\Fhs-srv-array1\Users\www\my documents\From my old computer"
after changing
"\\Fhs-srv-array1\Users\www\my documents\From my old computer"
to a letter drive (Y:) it worked fine.
I should try that.Thanks.
I'm afraid I'm stumped on this one.
Are you running SAS locally or on the server? If you are running on the server, it may require different drive mappings than you have on your local PC.
I`m running SAS on server. I have other drives which is mapped the same way as Q: drive. There is no such problem when pulling data from other drives which is also mapped similar to Q: drive.
I don`t know why it is not working.
Hi,
save a simple file to the same location to try to read it.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.