DATA Step, Macro, Functions and more

not to generate variable names from excel

Reply
Frequent Contributor
Posts: 81

not to generate variable names from excel

Hello,

I'm using SAS 9.1.3 and I need to import excel 2007 (.xlsx) files into SAS so, I am using SAS/ACCESS interface to ODBC with the Excel 2007 ODBC driver. This method works fine, but it automatically generates variable names from the first row of excel sheet. Is there an option to prevent this (like GETNAMES=NO in proc import)?

My code:

libname myxls odbc required="Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};
dbq=c:\spreadsheet.xlsx"
access=readonly defer=yes;

data one;
set myxls."data$A9:Z500"n;
run;

thanks for your time!! Message was edited by: Nick R
Occasional Contributor
Posts: 7

Re: not to generate variable names from excel

Super Contributor
Super Contributor
Posts: 3,174

Re: not to generate variable names from excel

More the topic, use this Google advanced search argument to find relevant SAS support http://support.sas.com/ topic papers/references.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search arguments, this topic / post:

sas 9.1.3 excel xlsx support site:sas.com

sas 9.1.3 getnames site:sas.com
Frequent Contributor
Posts: 81

Re: not to generate variable names from excel

Thanks. I tried searching using Google advanced search argument but no luck so far. Will contact SAS technical support.
Frequent Contributor
Posts: 81

Re: not to generate variable names from excel

The link you've provided describes importing .XLS files. I need to import .XLSX (excel 2007) files, without generating variable names from the spreadsheet.
Super User
Posts: 9,687

Re: not to generate variable names from excel

How about :
[pre]
libname xls excel path='c:\test.xls' header=no;
proc sql;
create table xls as
select * from xls.'Sheet1$'n;
quit;
[/pre]



Ksharp
Ask a Question
Discussion stats
  • 5 replies
  • 423 views
  • 0 likes
  • 4 in conversation