BookmarkSubscribeRSS Feed
scb
Obsidian | Level 7 scb
Obsidian | Level 7

 

I can't import the below excel file.  Please advise.  Thanks.


%let yyyymm=201604;

PROC IMPORT OUT=car_&YYYYMM
DATAFILE="c:\car_&yyyymm.xlsx"
DBMS=EXCEL REPLACE;
getnames=YES;
RUN;

2 REPLIES 2
art297
Opal | Level 21

You said you can't import the file. A couple of questions:

 

Does your site license SAS/Access for PC File Formats? 

What kind of error message are you getting?

Have you tried DBMS=XLSX

Is your workbook actually located in the root of the c: drive?

 

Art, CEO, AnalystFinder.com

 

 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

I would advise to post relevant information.  What does the log say for instance?  Do you have access to that file (i.e. SAS UE runs on its on virtual image so no C:).  From what you have posted its versy hard to even tell what you are trying.  Check this line in the log:

DATAFILE="c:\car_&yyyymm.xlsx"

 

Is there a space between the macro and the .xlsx for instance, if so then:

DATAFILE="c:\car_%trim(&yyyymm.).xlsx

 

Oh, and typing that I have just seen what the problem is.  A macro variable needs a dot after it, so this resolves to:

c:\car_201604xlsx"

 

Which is wrong.  You need a dot to end the macro variable and a dot before the extension like:

DATAFILE="c:\car_&yyyymm..xlsx"

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
  • 2 replies
  • 1435 views
  • 0 likes
  • 3 in conversation