BookmarkSubscribeRSS Feed
Oleg_L
Obsidian | Level 7

Hello SAS-users.

I use the code below to import a specific range from XLS sheet.

The first row of the range becomes the variables names.

I want the automatic variables names (similarly option GETNAMES=NO in PROC IMPORT).
Is it possible with OLEDB?

libname boo oledb
init_string="provider=Microsoft.ACE.OLEDB.12.0;
data source=\\xxxxx.xxxx.xxx.xx\UOLib\test\SNB0_monthly_mar12.xls;
extended properties=Excel 8.0";

data new; set boo.'M-7$A6:H3000'n; run;

libname boo clear;

Regards,

Oleg.

1 REPLY 1
Oleg_L
Obsidian | Level 7

I found the solution.

HDR=Yes or HDR=No. See code below.

libname myxls oledb ACCESS=READONLY provider="Microsoft.ACE.OLEDB.12.0"

properties=("data source"="&fullname" "Mode"="Read")

provider_string="Excel 8.0;ReadOnly=True;HDR=no;IMEX=1;"

;

Regards,

Oleg.

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!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2281 views
  • 0 likes
  • 1 in conversation