BookmarkSubscribeRSS Feed
stat11
Calcite | Level 5
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.
1 REPLY 1
LinusH
Tourmaline | Level 20
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...;).

/Linus
Data never sleeps

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Discussion stats
  • 1 reply
  • 3918 views
  • 0 likes
  • 2 in conversation