BookmarkSubscribeRSS Feed
Dreamer
Obsidian | Level 7

Hi All,

 

I am trying to import a Macro enabled Excel file (xlsm).

I am using following code to do this:

PROC IMPORT DATAFILE='/home/Excelfile.xlsm'  
DBMS=xlsx replace
OUT=work.test ;
SHEET="Sheet1";
GETNAMES=YES;
RUN;

But it shows following error:
ERROR: XLSX file does not exist -> /home//Excelfile.xlsm.xlsx

 

I don't understand why its adding extra "/" and "xlsx" around the file name.

This code works fine for a "xlsx: file format.

I am using SAS 9.3 and EG 5.1

 

Can anyone help me in reading a xlsm file format?

 

Any help will be much appreciated.

 

Thanks in advance!!

5 REPLIES 5
art297
Opal | Level 21

Have you tried simply changing the line that is currently: dbms=xlxs

to

dbms=excel

 

Dreamer
Obsidian | Level 7

Yes, but also didn't work.

Dreamer
Obsidian | Level 7

This file is delivered from a different source and I have only read access to it.

I can write VBA to save this file as XLSX to some different location and then point SAS to read it from there.

But before doint that first I want confirm that there is no way I can read a XLSM file through SAS.

Kurt_Bremser
Super User

It might be that the .xlsm format is only supported on Windows, as a VBA engine is needed to run the macros. And since even pre-ODF macros (Excel 4.0) are supported, I suspect that the .xlsm format may contain all kinds of (insert suitable 4-letter expletive here).

 

BTW, I don't see ANY reasson why a simple transfer of data needs macros. There seems to be a serious process design flaw here.

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 5 replies
  • 10554 views
  • 1 like
  • 3 in conversation