SAS Office Analytics, SAS Add-In for Microsoft Office, and other integrations

PROC IMPORT - Excel multiple ranges?

Reply
Occasional Contributor
Posts: 12

PROC IMPORT - Excel multiple ranges?

Hello,

Is it possible to input multiple ranges when using PROC IMPORT on an Excel file?

PROC IMPORT DATAFILE = "C:\abcSept08.xls"
OUT = abc_Sep08
DBMS = EXCEL2000 REPLACE;
RANGE = "XYZ$B48:Q51";
GETNAMES = NO;
RUN;

Above is my current code. If I also want to bring in cells B121:Q140 and B210:Q234, is it possible to do it all in one step?

Thanks for your help.
Super User
Posts: 5,387

Re: PROC IMPORT - Excel multiple ranges?

It seems that you cannot do that.
So your choices are:
- run multiple imports, and then append the different result sets
- read the whole Excel-sheet and post process it
- use the LIBNAME excel engine together with named ranges, each named range will appear as separate SAS tables, which you could read in one operation (data-set a b c...Smiley Wink.

/Linus
Data never sleeps
Ask a Question
Discussion stats
  • 1 reply
  • 1136 views
  • 0 likes
  • 2 in conversation