BookmarkSubscribeRSS Feed
xxformat_com
Barite | Level 11

When using excel engine or the sheet option of proc export, the sheet name can be specified using n-literal.

The downside is that the name is converting to SAS naming convention.

In the example, the blank is replaced with an underscore in the Excel file.

Is there a way of keeping the space?

 

 

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

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

libname demo clear;
5 REPLIES 5
Tom
Super User Tom
Super User

Set the VALIDMEMNAME option to EXTEND.

libname x xlsx 'c:\downloads\testblank.xlsx' ;
options validmemname=extend;
data x.'sashelp class'n ;
  set sashelp.class;
run;
libname x clear;
xxformat_com
Barite | Level 11
Thanks. Nearly there. It works with xlsx engine but when trying it with excel engine, it does not.
Tom
Super User Tom
Super User
Yet another good reason to not use the EXCEL engine.
Reeza
Super User

Excel is an older libname and designed for xls not xlsx files. The two do not have the same functionality and this is documented, do not expect the same functionality between the two.

 

In some cases, XLS has some more options and XLSX has more. I would resort to using XLSX by default as it's the more modern approach and the files. You can use a VB script to convert your workbooks to the other format if needed. 

 


@xxformat_com wrote:
Thanks. Nearly there. It works with xlsx engine but when trying it with excel engine, it does not.

 

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 5 replies
  • 931 views
  • 1 like
  • 4 in conversation