1
votes

I am trying to import an excel sheet into SAS, but for some reason, SAS isn't able to find the workbook. Here is the code and the error I that I get:

PROC IMPORT Out=Transactionsmaster DATAFILE="C:\Users\me\Documents\Transactions"
DBMS=XLSX Replace;
GETNAMES=YES;
RUN;

ERROR: XLSX file does not exist -> /config/Lev1/SASApp/C:\Users\me\Documents//Transactions.xlsx

Do I have to import the excel sheet onto the SASApp first? Is there a way to do this without using the import wizard?

Thanks in advance!

3

3 Answers

2
votes

Let's take a look at the error message:

ERROR: XLSX file does not exist -> /config/Lev1/SASApp/C:\Users\me\Documents//Transactions.xlsx

Look at the file path.

/config/Lev1/SASApp/

is clearly a path on a Linux/Unix server. This is the default location when running a Workspace server. From this, I will guess you connected to SAS through Enterprise Guide (EG).

C:\Users\me\Documents//Transactions.xlsx

This is the path you entered.

So what happened? SAS is running on a remote server -- a server running Linux/UNIX. You asked SAS to open "C:\Users\me\Documents//Transactions.xlsx".

However, "C:\stuff\more\file" is not a valid filesystem path on Linux/UNIX. So SAS assumed this was the file name and looked for it in the default location "/config/Lev1/SASApp"

To fix this, you need to upload your XLSX file to the server. Then use the path to the file on the server in your code. Talk to your system admin if you are unsure how to do this.

Alternatively, you can use the Data Import Wizard in EG. I'm not a fan of it as it screws things up at times, but it does work.

0
votes

If you run this code using Enterprise Guide or DI (i.e. you are submitting the code to remote SAS server) you need to transfer the file to the server side. You can transfer your file using PROC UPLOAD.

0
votes

Close the file before importing it if you haven't already. You may also be referencing a folder instead of a file in your example (unless Transactions.xlsx is the file you want to import)