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"
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.