BookmarkSubscribeRSS Feed
valentina71
Fluorite | Level 6

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

7 REPLIES 7
andreas_lds
Jade | Level 19
Look at the second cause for the error mentioned in the error message: you can't import an Excel file while it is open.
valentina71
Fluorite | Level 6

it's not opened!

Kurt_Bremser
Super User

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.

valentina71
Fluorite | Level 6
I have full rights on that shared resource, like other 3 people
Patrick
Opal | Level 21

@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?

 

valentina71
Fluorite | Level 6

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**

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 3177 views
  • 0 likes
  • 4 in conversation