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';

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 6 replies
  • 1232 views
  • 2 likes
  • 4 in conversation