Unable to import an excel file through EG... here is the code (removed various parts for security).
The log shows an additional slash being added... not sure how to fix (SAS EG 7.13):
%Let Upload = /sasdata/users/jondoe1/;
%Let Path_In = \\Client\S$S:\DA_work_files\filename.xlsx;
/*Run Copy Task to Copy to Out network*/
Proc Import Out=jondoe1_Lib.list
Datafile='//sasdata/users/jondoe1/filename.xlsx'
dbms=xlsx replace;
Sheet='List';
Run;
The macros run fine.
Log:
ERROR: Physical file does not exist, //sasdata/users/jondoe1//filename.xlsx.
The extra slashes aren't the issue. Is your XLSX file on the server?
I am not sure, as this is a colleague's work. I was assuming the first statement would bring the file into the sasusers folder. I ended up using the import wizard and importing the file directly, rather than making it two steps. That worked.
Thank you for your help.
Yeah, I think you're running into the 'server' vs 'desktop' issue. the file is on your local drive and you can't access it until its on the server. The GUI doesn't have the same restriction.
Yes, this is super annoying.
Actually the two slashes at the beginning of the path indicate that this is a UNC path so depending on the site specific topology such a path could work from both client and server side.
//sasdata/users
Not sure why you believe the two slashes in the middle of the pathname aren't an issue. I believe they are.
//sasdata/users/jondoe1//filename.xlsx
The code you've posted doesn't show it but eventually remove the last slash in below command line.
%Let Upload = /sasdata/users/jondoe1/;
@Patrick I don't know why it's not an issue, but I know that it is. SAS frequently does this and if you include 2 it works fine as well. See code and log below.
I *think* it might be the local vs server issue because in the middle of the path is S:\ -> Looks like a drive mapping, but I could definitely be wrong there.
%Let Upload = /sasdata/users/jondoe1/;
%Let Path_In = \\Client\S$S:\DA_work_files\filename.xlsx;
Code:
proc import out=want datafile='/folders/myfolders//output.csv' dbms=csv replace;
run;
ERROR: Physical file does not exist.
Reasons:
I just encountered this double-slash issue myself, and the root of the problem was that the file to import was open. Once I closed the file, the proc import worked fine.
The extra / in the error message is a BUG in the error report code of PROC IMPORT. It does that for XLSX engine, but not for the CSV engine.
Example:
proc import datafile='~/nosuchfile' out=want dbms=xlsx;
run;
proc import datafile='~/nosuchfile' out=want dbms=csv;
run;
Results:
69 proc import datafile='~/nosuchfile' out=want dbms=xlsx; 70 run; ERROR: Physical file does not exist, /home/user1//nosuchfile. 71 proc import datafile='~/nosuchfile' out=want dbms=csv; 72 run; ERROR: Physical file does not exist, /home/user1/nosuchfile.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.