DATA Step, Macro, Functions and more

File Does Not Exist But It does

Reply
Occasional Contributor
Posts: 9

File Does Not Exist But It does

Hi SAS-friends,

I need some help if you can...

 

I have to import 88 excel files (about diseases and surgery operation).. they all have the same variables..  I can do it by manual procedures (file/import/ etc....) but It's too long.

so I wrote:

 

PROC IMPORT DATAFILE='C:\Users\savioli\Documents\BELLOMBRA_ANNO_2016_ok.xls'
DBMS=excel out =sasuser.bellombra_4_trim replace;
RUN;

 

but Sas told me:

ERROR: Unable to open file C:\Users\savioli\Documents\BELLOMBRA_ANNO_2016_ok.xls. It does not  
       exist or it is already opened exclusively by another user, or you need permission to
       view its data.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           0.09 seconds
      cpu time            0.03 seconds

 

My file is in the same server where I use SAS.

thank you from Italy,

Valentina

Valued Guide
Posts: 629

Re: File Does Not Exist But It does

Posted in reply to valentina71
Look at the second cause for the error mentioned in the error message: you can't import an Excel file while it is open.
Occasional Contributor
Posts: 9

Re: File Does Not Exist But It does

Posted in reply to andreas_lds

it's not opened!

Super User
Posts: 10,571

Re: File Does Not Exist But It does

Posted in reply to valentina71

valentina71 wrote:

it's not opened!


What did you do to verify that?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Super User
Posts: 10,571

Re: File Does Not Exist But It does

Posted in reply to valentina71

Make sure that no instance of Excel is running while you try the import. If the Excel file resides on a shared resource, this might become tricky, as you need to inform everyone having access to that to make sure that nobody has the file open.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Occasional Contributor
Posts: 9

Re: File Does Not Exist But It does

Posted in reply to KurtBremser
I have full rights on that shared resource, like other 3 people
Respected Advisor
Posts: 4,797

Re: File Does Not Exist But It does

[ Edited ]
Posted in reply to valentina71

@valentina71

It's highly likely that someone or some process "locks" your Excel. To test the theory: Manually create a copy of the Excel then run your code against this copy. If that works then the theory is more or less confirmed.

 

As for importing 88 same structured Excels: We can certainly help you with this. Are they all in the same directory? Do they follow some naming convention (name of workbook, name of tab in workbook)?  ...and what SAS version are you using?

 

Occasional Contributor
Posts: 9

Re: File Does Not Exist But It does

version is 9.3; yes all the files are in the same directory (shared by I have full rights).. no conventions, hospital'sname & mounth in the name of the file...

 

the problem is the proc import, doesnt' work...

I have only today to import.

Tomorrow I manually import......**bleep**

Ask a Question
Discussion stats
  • 7 replies
  • 170 views
  • 0 likes
  • 4 in conversation