BookmarkSubscribeRSS Feed
Sabharish
Fluorite | Level 6

Hi,

 

while running this program.

 

proc import datafile="Z:\Users\Ramanathan\test1.xls" out=ab dbms=excel replace;
sheet="xdm";
getnames=yes;
datarow=4;
run;

 

I'm getting error in datarow statement. I don't know why? can anyone explain me.

 

Thanks

6 REPLIES 6
Reeza
Super User

Is datarow supported for DBMS Excel? It doesn't look like it.

What version of SAS do you have?

 

It's sometimes hard to navigate the documentation for PROC Import. 

 

http://support.sas.com/documentation/cdl/en/acpcref/67382/HTML/default/viewer.htm#n0msy4hy1so0ren1ac...

Sabharish
Fluorite | Level 6

hi reza,

 

I have sas 9.2.

Sabharish
Fluorite | Level 6

hi,

 

how to read multiple sheet from a excel file with xsl engine. And how to restrict the number of obs in the dataset while importing from an excel file.

Reeza
Super User

Try a libname method with proc copy or datasets. 

Assign a libname and then use PROC datasets with a copy statement to copy sheets to library. 

 

How do you want to restrict observations? What's your logic?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

What is the question here exactly?  To import from Excel your options are proc import, libname excel, saving the file to a proper formats such as CSV and datastep import - all of which there are thousands of examples on here.  To limit the number of observations, just read the file, then do:

data want;

  set have (obs=...);

run;

 

To read multiple sheets, use the sheetname="..." option in proc import, or save each sheet to a separate CSV, or use libname excel.

 

Ksharp
Super User
Try
startrow=4

or multiple range option:
range='A1:D10';
range='A10:D20';

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1696 views
  • 2 likes
  • 4 in conversation