BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Saravanan
Fluorite | Level 6

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

1 ACCEPTED SOLUTION

Accepted Solutions
Kathryn_SAS
SAS Employee

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.

 

  • Any part of the path or filename is misspelled
  • The directory or subdirectory does not exist
  • The drive may not be mapped to the correct location
  • Permission issues
  • Server issues
  • Special characters or spaces are used in the directory or filename where they are not supported

 

View solution in original post

28 REPLIES 28
ballardw
Super User

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.

Saravanan
Fluorite | Level 6

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

bentleyj1
Quartz | Level 8

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.

Saravanan
Fluorite | Level 6

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.

bentleyj1
Quartz | Level 8

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.

Saravanan
Fluorite | Level 6

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.

niam
Quartz | Level 8

make sure that the file is closed when you run the code, sometimes if the file is open by another program, this may happen

Saravanan
Fluorite | Level 6

File is closed and it is not used by anyother program. Much appreciated.

Linlin
Lapis Lazuli | Level 10

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.

Saravanan
Fluorite | Level 6

I should try that.Thanks.

bentleyj1
Quartz | Level 8

I'm afraid I'm stumped on this one.

Doc_Duke
Rhodochrosite | Level 12

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.

Saravanan
Fluorite | Level 6

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.

Linlin
Lapis Lazuli | Level 10

Hi,

save a simple file to the same location to try to read it.

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 28 replies
  • 151516 views
  • 4 likes
  • 12 in conversation