DATA Step, Macro, Functions and more

Error: Physical file does not exist when doing macro import

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Error: Physical file does not exist when doing macro import

I am doing a macro import of data from excel and it has worked except for a specific set of data. This data is on my computer and the format of the data is the same as the rest so I do not know why only that data has that error. I have attached these pictures which are the macro code, the error message I get for the specific data, and an example of the successful macro import for my other data. 

I would appreciate any suggestions on how to fix this error. 

2017-10-30 (1).png2017-10-30 (2).png2017-10-30 (3).png


Accepted Solutions
Solution
‎10-31-2017 04:59 PM
Super User
Posts: 24,003

Re: Error: Physical file does not exist when doing macro import

Copy the path to the file from the log. Paste it into your browser and see if the file opens. If it doesn't, the file doesn't exist. There's probably a small text anomaly with that file, ie an extra space or someone put 04 instead of 4.

View solution in original post


All Replies
Super User
Posts: 2,512

Re: Error: Physical file does not exist when doing macro import

Show us the (trimmed if necessary) output from this:

filename DIR pipe 'dir "c:\fullpath" ';
data _null_;
  infile DIR;
  input; 
  putlog _infile_;
run;
Super User
Posts: 10,570

Re: Error: Physical file does not exist when doing macro import

[ Edited ]

Make sure that the file is there. When SAS says a file ain't there, it ain't there, period.

It also helps to have easily usable names for paths and files:

- no blanks

- no special characters (aside from letters, digits, underlines or dots)

 

Sometimes an inserted special character in a filename (like a tab) might disguise as a blank and cause confusion. So instead of blanks, always use underlines.

 

See Maxim 44.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Solution
‎10-31-2017 04:59 PM
Super User
Posts: 24,003

Re: Error: Physical file does not exist when doing macro import

Copy the path to the file from the log. Paste it into your browser and see if the file opens. If it doesn't, the file doesn't exist. There's probably a small text anomaly with that file, ie an extra space or someone put 04 instead of 4.
New Contributor
Posts: 2

Re: Error: Physical file does not exist when doing macro import

Thank you. I had an extra space after the last character in my filename.
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 364 views
  • 0 likes
  • 4 in conversation