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!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1960 views
  • 5 likes
  • 3 in conversation