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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 484 views
  • 1 like
  • 4 in conversation