BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
lgutie1808
Fluorite | Level 6

Hello, 

 

I'm using the following code to import a Microsoft Excel Worksheet (.xls) dataset into SAS 9.4:

 

proc import out=Sleep
datafile="H:\NIAGEN Clinical Trial\Fellowship Project\Datasets\SAS Programs for Data Analysis"
DBMS=EXCEL REPLACE;
RANGE="Sheet1$"; 
GETNAMES=YES; 
MIXED=YES; 
SCANTEXT=YES;
USEDATE=YES;
SCANTIME=YES;
run;

 

However, I keep getting this error message in the Log:

 

<<ERROR: Unable to open file H:\NIAGEN Clinical Trial\Fellowship Project\Datasets\SAS Programs
for Data Analysis.XLS. It does not exist or it is already opened exclusively by
another user, or you need permission to view its data.>>

 

I don't have the file open when I'm running this code.

 

Many thanks in advance for some advice!

1 ACCEPTED SOLUTION

Accepted Solutions
lgutie1808
Fluorite | Level 6

Thanks for noting that!

 

I have tried this code adding the name of the excel file and it worked!

 

proc import datafile = 'H:\NIAGEN Clinical Trial\Fellowship Project\Datasets\SAS Programs for Data Analysis\COVID_Niagen_Sleep_SAS_1.0.xlsx'
out = COVID.Sleep
dbms = xlsx
replace;
run;

 

Thank you!

View solution in original post

7 REPLIES 7
Reeza
Super User
You're running SAS 9.4 on your local computer?

If you navigate to the path using the file explorer you can see the file?
lgutie1808
Fluorite | Level 6

I'm getting access to the software in my local computer through VPN and the use of a remote desktop. H: is my workplace drive.

Yes! I can see the file when I navigate to the path using the file explorer. 

Thank you.

Reeza
Super User
What is the name of the Excel file?
SAS programs for data analysis seems like a folder name not an Excel file name but I've seen worse....
lgutie1808
Fluorite | Level 6

Thanks for noting that!

 

I have tried this code adding the name of the excel file and it worked!

 

proc import datafile = 'H:\NIAGEN Clinical Trial\Fellowship Project\Datasets\SAS Programs for Data Analysis\COVID_Niagen_Sleep_SAS_1.0.xlsx'
out = COVID.Sleep
dbms = xlsx
replace;
run;

 

Thank you!

lgutie1808
Fluorite | Level 6

Thanks for both comments. 

 

I've added the name of the excel file and it worked!

 

The successful code is provided below:

 

proc import datafile = 'H:\NIAGEN Clinical Trial\Fellowship Project\Datasets\SAS Programs for Data Analysis\COVID_Niagen_Sleep_SAS_1.0.xlsx'
out = COVID.Sleep
dbms = xlsx
replace;
run;

 

Thank you!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1082 views
  • 5 likes
  • 3 in conversation