BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
GBL__
Quartz | Level 8

Hello,

 

I am trying to create a very simple xlsx file, but I am wanting to create the file with the "standard" excel format (i.e. I want to have it look like Excel when you open a blank workbook).

 

For some reason, I seem to be unable to get this result.  On my end, STYLE=htmlblue and STYLE=excel are producing the exact same output.  Is this normal?

 

I am wondering if I messed up the excel style template somehow?  Am I able to go back to default?  Can I do what I am wanting to do?

 

ODS EXCEL FILE="&file_path.\STATS.xlsx" STYLE=htmlblue OPTIONS(SHEET_NAME="Stats") ;

PROC PRINT DATA=t_STATS NOOBS ;
RUN ;

ODS EXCEL CLOSE ;


ODS EXCEL FILE="&file_path.\STATS2.xlsx" STYLE=excel OPTIONS(SHEET_NAME="Stats") ;

PROC PRINT DATA=t_STATS NOOBS ;
RUN ;

ODS EXCEL CLOSE ;

 

Thanks! 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

The SAS supplied Excel style, as far as I can tell, is not intended to duplicate the "default" Excel appearance.

 

Check the actual definition of your Excel style. This code will show the source of the style definition in the SAS default location.

proc template ;
path sashelp.tmplmst;
source styles.excel;
run;

If your setup is similar to mine the log will show something similar to:

12   proc template ;
13   path sashelp.tmplmst;
14   source styles.excel;
define style Styles.Excel;
   parent = styles.HTMLBlue;
end;
NOTE: Path 'Styles.Excel' is in: SASHELP.TMPLMST.
15   run;

The important part for you question is the bit following line 14 above, which is the definition of the style. The parent means "copy attributes from Styles.Htmlblue". With nothing else in the definition it is in effect a copy of Htmlblue.

View solution in original post

3 REPLIES 3
ballardw
Super User

The SAS supplied Excel style, as far as I can tell, is not intended to duplicate the "default" Excel appearance.

 

Check the actual definition of your Excel style. This code will show the source of the style definition in the SAS default location.

proc template ;
path sashelp.tmplmst;
source styles.excel;
run;

If your setup is similar to mine the log will show something similar to:

12   proc template ;
13   path sashelp.tmplmst;
14   source styles.excel;
define style Styles.Excel;
   parent = styles.HTMLBlue;
end;
NOTE: Path 'Styles.Excel' is in: SASHELP.TMPLMST.
15   run;

The important part for you question is the bit following line 14 above, which is the definition of the style. The parent means "copy attributes from Styles.Htmlblue". With nothing else in the definition it is in effect a copy of Htmlblue.

GBL__
Quartz | Level 8

Thanks, @ballardw 

 

This completely makes sense and I understand now.  Kind of weird that there are two htmlblue styles, though?

 

Thanks again!

ballardw
Super User

@GBL__ wrote:

Thanks, @ballardw 

 

This completely makes sense and I understand now.  Kind of weird that there are two htmlblue styles, though?

 

Thanks again!


It may be that the ODS Excel statement looks internally for a styles.excel to use if you do not specify a style on the ODS statement. ODS RTF and PDF have their own styles that are used instead of Htmlblue, or what ever other current default style is effect when used as a destination. You have to override them with something to get a different style appearance. So I suspect SAS created the Excel style in the same vein.

However it does mean you can create your own. I tend not to replace SAS supplied anything in the ODS world, mainly because upgrades tend to wipe out such when modified. If you make a style you like better then just remember to use it for ODS Excel destination statements.

 

I generate more ODS RTF output and my preferred style is added by habit to the statement after several years (I hate the default font/ fontsize).

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
  • 3 replies
  • 1877 views
  • 0 likes
  • 2 in conversation