BookmarkSubscribeRSS Feed
xxformat_com
Barite | Level 11

With the dbms=xlsx, it is possible to use range='All_Students$A2:0' to import all the lines from line 2. But it does not work with dbms=excel. Is it meant to be or is it just a bug in SAS 9.4?

 

libname demo excel "&xxdemo./reporting/class.xlsx";

data demo.'All Students'n;  
    set sashelp.class;
run;

libname demo clear;

proc import datafile = "&xxdemo./reporting/class.xlsx" 
            out      = demo
            dbms     = xlsx
            replace;
    getnames=no;
    range='All_Students$A2:0';
run;
2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

It is meant to be this way.

You can point to the desired range when using the libname by using a name starting with $.

You may find these papers interesting De-Mystifying the SAS® LIBNAME Engine in Microsoft Excel: A Practical Guide and How to use SAS to read a range of cells from Excel

xxformat_com
Barite | Level 11

I'm alraedy using a $ sign in front of the range.
The link you provided https://blogs.sas.com/content/sasdummy/2018/06/21/read-excel-range/ only use xlsx.
The question is on excel dbms/engine.

Do you have any example with excel?

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1063 views
  • 0 likes
  • 2 in conversation