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"

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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