BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sivastat08
Pyrite | Level 9

 

hi ,i'm trying to import multiple sheets in sas eg below is the code i used,

 

 

%macro pim(sheet);
proc import out= AR
datafile = 'C:\Users\sivakumar.sivaraj\Desktop\Data_Import.xlsx'
dbms = Excel;
sheet = "&sheet";
getnames = yes;
run;
%mend pim;
%pim(DumpKey);
%pim(UniqueProcedureID);
%pim(ReportDateIST);

 

after running this code its showing below error. can any one please help me to fix this.


ERROR: Unable to open file C:\Users\sivakumar.sivaraj\Desktop\Data_Import.xlsx. It does not exist or it is already opened
exclusively by another user, or you need permission to view its data.

 

thanks,

siva

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

In EG, do you use "Local" as your server, or another workspace server definition?

If other than Local, your workspace server may run on a remote computer and therefore can't "see" your C: drive.

If Local, it may be that the file is kept open by the last program that used it (probably Excel itself). Make sure that all Excel instances are closed and try again.

 

View solution in original post

4 REPLIES 4
Kurt_Bremser
Super User

In EG, do you use "Local" as your server, or another workspace server definition?

If other than Local, your workspace server may run on a remote computer and therefore can't "see" your C: drive.

If Local, it may be that the file is kept open by the last program that used it (probably Excel itself). Make sure that all Excel instances are closed and try again.

 

sivastat08
Pyrite | Level 9

Thanks for the quick replay Kurt,the sas is working on workspace server and i'm importing file from local desktop.i have checked agin its showing the same error

"ERROR: Unable to open file C:\Users\sivakumar.sivaraj\Desktop\Data_Import.xlsx. It does not exist or it is already opened
exclusively by another user, or you need permission to view its data."

 

is it stating any access level restriction..kindly hhelp me resolve this..

Kurt_Bremser
Super User

Right-click on the server in your server list, select Properties.

You will see the hostname of the physical machine where your workspace server is running.

If it is not the name of your desktop, you have a remote installation. In this case,

- copy the file(s) to that server, preferably your home directory there. Use WinSCP or similar.

or

- if your desktop and the server have access to a common network resource (or the server shares a resource you could use from your desktop), copy the file(s) there and use them from there. Ask the network/server admin for path names.

 

sivastat08
Pyrite | Level 9

thanks for detailed replay Kurt.

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
  • 4 replies
  • 2325 views
  • 2 likes
  • 2 in conversation