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;
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
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"
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.