Proc Import Excel Range

  • Follow


Does anyone know of a way to specify different ranges in Proc Import?
For example, if I have the labels on row 2 and the data doesn't
actually start until row 15, is there a way to skip rows 3-14?

Thank you
0
Reply brentvtimothy (57) 3/17/2010 6:31:10 PM

data excel;
   set excel;
   row=_n_;
run;

proc sql;
   delete from excel
   where row LT 15;
quit;
0
Reply montura 3/17/2010 6:59:24 PM


Deleting rows is easy, but what if you don't want to read them, as it
can change the format that Proc Import reads?  If the first 15 rows
are missing, or are filled with notes, and you only have 10 rows of
actual data to read in, then the data is set to character even if the
data are all numerical, as the majority of values are now character.
When you are reading in multiple excel sheets, and some have these
note rows, is there a way to skip the note rows to avoid multiple
character to numeric changes?

0
Reply FPAStatman 3/18/2010 2:09:58 PM

This should work - use getnames for the labels and datarow for the
data.

proc import datafile="c:\My Spreadsheet.xls"
			dbms=xls
			out=NewDataSet
			replace
			;
	sheet="Sheet1";
	getnames=Yes;
	datarow=15;
run;

0
Reply Ste 5/4/2010 3:54:12 PM

3 Replies
613 Views

(page loaded in 0.131 seconds)

Similiar Articles:











7/29/2012 8:12:38 AM


Reply: