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?

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 942 views
  • 0 likes
  • 2 in conversation