BookmarkSubscribeRSS Feed
rajeshalwayswel
Pyrite | Level 9

I'm unable to import excel file with extension xlsx. I'm using the below code.

 

proc import datafile='.xlsx' dms=xlsx replace;

run;

 

Could you please help out how to resolve this... 

3 REPLIES 3
SASKiwi
PROC Star
proc import datafile='MyExcelWorkbook.xlsx' dbms=xlsx replace;

run;
r_behata
Barite | Level 11

Try :

 


proc import datafile="<your-path>.xlsx" dbms=xlsx replace;

run;

If you are using SAS 9.4 M2 or above you can also use Libname XLSX :

 

https://blogs.sas.com/content/sasdummy/2015/05/20/using-libname-xlsx-to-read-and-write-excel-files/

 

 

ed_sas_member
Meteorite | Level 14

In addition to @r_behata's and @SASKiwi's answers, it could be useful to also add:

  • an OUT option in the PROC IMPORT statement to specify the name of the output SAS dataset.
  • a SHEET statement to specify the name of the sheet you to be imported in case you have several ones.
  • an GETNAMES statement to specify whether the first row of your Excel file contains the names of the variables (Yes | No).

 

proc import datafile="<your-path>.xlsx"
			dbms=xlsx
			out=<lib.dataset>
			replace;
			sheet=<sheet_name>;
			getnames=Yes;
run;

 

 

sas-innovate-2024.png

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.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 544 views
  • 1 like
  • 4 in conversation