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!
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.
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.
Thanks, @ballardw
This completely makes sense and I understand now. Kind of weird that there are two htmlblue styles, though?
Thanks again!
@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 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.