Date: Mon, 14 Jan 2002 16:06:23 -0500
Reply-To: Paige Miller <paige.miller@KODAK.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Paige Miller <paige.miller@KODAK.COM>
Organization: Eastman Kodak Company
Subject: Re: Import Excel Worksheet starting from row 21
Content-Type: text/plain; charset=us-ascii
Jerry Barnes wrote:
>
> I was wondering if it is possible to import data into a table starting
> from row 21 of an excel worksheet. I need to set up an automated
> procedure to generate a graph on the data from row 21 to the end of
> the file. The information above row 21 is important but it is not in
> a format that allows importing and it is not needed for the graph.
There are two methods that I can think of:
Method 1
Use DDE, tell SAS to begin looking in row 21. The example below reads
rows 21-110 and columns 2-11:
filename indata dde 'excel|Sheet1!r21c2:r110c11';
data a;
infile indata missover;
input x1 - x10;
run;
Method 2
Use PROC IMPORT. First, you have to create a data range in EXCEL
containing the data you want, beginning in row 21, then save the
spreadsheet. The RANGE=command tells PROC IMPORT to look for the range
you created, it must have the same name as the one you created in Excel.
In this example, I have gotten creative and called it data_area.
PROC IMPORT OUT= WORK.a
DATAFILE= "C:\yourspreadsheet.xls"
DBMS=EXCEL2000 REPLACE;
RANGE="data_area";
GETNAMES=NO; /* or GETNAMES=YES; your choice */
RUN;
--
Paige Miller
Eastman Kodak Company
paige.miller@kodak.com
"It's nothing until I call it!" -- Bill Klem, NL Umpire
"When you get the choice to sit it out or dance,
I hope you dance" -- Lee Ann Womack