With proc import dbms=xlsx, it is possible to use getnames=no.
But with the xlsx engine, I get an error message when using getnames=no.
Is it meant to be or is it a bug?
libname demo excel "&xxdemo./reporting/class.xlsx";
data demo.'All Students'n;
set sashelp.class;
run;
libname demo clear;
proc import datafile = "&xxdemo./reporting/class.xlsx"
out = demo
dbms = xlsx
replace;
getnames=no;
range='All_Students$A2:0';
run;
libname demo xlsx "&xxdemo./reporting/class.xlsx";* getnames=no;
data demo;
set demo.'All_Students$A2:0'n;
run;
libname demo clear;
proc print data=demo;
run;
There is no mention of any GETNAMES option on the reference page for the XLSX libname engine.
It is meant to be this way.
getnames is a statement that only proc import supports.
I've been using SAS for 30 years. Also a negative cannot be proven. Also, google is your friend if you need to investigate. 🙂
Actually GETNAMES is also available with Proc Access for certain file types (Lotus 1-2-3 Wkn anyone). Other than that Proc Import is the only place you'll find this commonly. There may be other procs but they are very likely to be somewhat esoteric and not available to everyone.
From the on-line documentation for
Data Source
|
Syntax
|
Valid Value
|
Default Value
|
PROC IMPORT
|
PROC EXPORT
|
---|---|---|---|---|---|
EXCEL
|
DBDSOPTS
|
|
Yes
|
Yes
|
|
DBSASLABEL
|
Compat | None
|
Compat
|
Yes
|
No
|
|
Yes | No
|
Yes
|
Yes
|
No
|
||
MIXED
|
Yes | No
|
No
|
Yes
|
No
|
|
NEWFILE
|
Yes | No
|
No
|
No
|
Yes
|
|
RANGE
|
range name
|
|
Yes
|
No
|
|
SCANTEXT
|
Yes | No
|
Yes
|
Yes
|
No
|
|
SCANTIME
|
Yes | No
|
Yes
|
Yes
|
No
|
|
SHEET
|
sheet name
|
|
Yes
|
Yes
|
|
TEXTSIZE
|
1 to 32767
|
1024
|
Yes
|
No
|
|
USEDATE
|
Yes | No
|
Yes
|
Yes
|
No
|
There is no mention of any GETNAMES option on the reference page for the XLSX libname engine.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.