Generally, if you use a format in your DEFINE statement, you can have different formats used for different columns.
ods html file='c:\temp\summarize.html' style=sasweb;
proc report data=sashelp.class(obs=5) nowd;
column name sex age height weight;
define name / order;
define sex / display;
define age / sum f=comma10.;
define height / sum f=dollar8.2;
define weight / sum f=dollar8.2;
age.sum = age.sum * 10000;
rbreak after / summarize style=Header;
Using the HEADER style for the summary line would be the same syntax using TAGSETS.EXCELXP. If you want Excel to use a different numeric format (other than the default General format) when it opens the XML file, you must use the TAGATTR style attribute to send a MICROSOFT format to Excel from SAS. With my version of TAGSETS.EXCELXP, the dollar formats are respected, but the COMMA format is not respected -- so you would have to use the TAGATTR style attribute to send a Microsoft format:
define age / sum f=comma10.
Thank you so much. I got the desired output. I just have one last question.
I had defined a style in a PROC TEMPLATE which included a "tagattr" format. But it wasn't being carried over to the summary. But it worked fine when I added the style override in the Define statement. Can you explain why this might happened.
I don't have a definitive answer about why using TAGATTR didn't work in a style template. I suspect that it's because TAGATTR is generally used with numeric variables only (you are sending a Microsoft number format using TAGATTR) -- and the TAGATTR value you specified might not have been appropriate for ALL the variables in your report. (TAGATTR would have been wrong for the NAME variable, for example.)
Everytime I use TAGATTR, I use it in a DEFINE statement (REPORT) or a VAR statement (PRINT) or, with TABULATE, in a TABLE statement using STYLE= overrides. That way, I have the most control over which format is explicitly used for which variable.
If you want to pursue why your style template did not work, you'll have to open a track with Tech Support. When I use the style template below, I do get TAGATTR used, even with character variables in the report.
idvar = _n_ * 10000;
age = age * 10000;