Hello everyone,
I've got a little problem with my proc import. Indeed, when I use the code below, it doesn't enable me to import .xlsx files, but only .xls
How could I change it to import both ?
Thanks
Here's my code :
PROC IMPORT OUT=TRAVAIL.INPUTS_1_&Q&Y
DATAFILE= "Y:\&Q&Y."
DBMS=EXCEL REPLACE;
RANGE="Sheet1$";
GETNAMES=YES;
MIXED=NO;
SCANTEXT=YES;
USEDATE=NO;
SCANTIME=YES;
Hi..
Convert .xlsx (2007) file to .xls (2003), in your computer and use your code. you can easily import the files..
Thanks,
Yaswanth
Hi..
You can convert the .xlsx file to .csv and using infile statement, you can easily get into sas environment without using proc import procedure.
data test;
infile '"path/file.csv";
run;
Along yaswanthj line of thinking, you could even write sas code to convert your Excel file to a csv without using an import, and then read in the csv file.
Try DBMS=EXCELS instead of EXCEL and then try.
SAS/ACCESS(R) 9.2 Interface to PC Files: Reference, Second Edition
Hello GuiVtzl,
the values for the DBMS options that you can use depend on your SAS version (including the "bitness", i.e. if you have 32bit or 64bit SAS).
If you have SAS 9.3 64bit maintenance release 1 (TS1M0), you can use either DBMS=XLS or DBMS=XLSX, but you have to decide which Excel format you want to support, since they are quite different.
If thats not possible, you probably have to go the CSV way like the other commentators suggested.
regards,
Johannes
You can extract the file extension using %let fileExtension = %scan(&excelFile, -1, %str(.)) and use it afterwards in the dbms option.
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.