The SAS Output Delivery System and reporting techniques

Style for line statement in Compute before ExcelXP

Reply
Occasional Contributor
Posts: 10

Style for line statement in Compute before ExcelXP

I am trying to get line statement of font size of 14 or bigger and background of yellow or some color, in the compute before statement.

SAS 9.2, most recent XP tagset,

ods listing close;
ods tagsets.excelXP file='c:\temp\test.xls' style=sasweb;
ods escapechar='^';

proc report data=sashelp.class(obs=3) nowd;
column name age height weight sex;
compute before / style={just=l protectspecialchars=off};
text1 = "^{style[font_size=14pt color=blue background = yellow]
fontsize should be 14pt background color is yellow}";
line text1 $;
endcomp;
run;
ods _all_ close;

Thanks
SAS Super FREQ
Posts: 8,743

Re: Style for line statement in Compute before ExcelXP

Hi:
This issue has come up before
http://support.sas.com/forums/thread.jspa?messageID=50109쎽

And I modified your code sample below to illustrate the issue. Compare the HTML output (MSOFFICE2K) with the XML output (ExcelXP) -- you can see that the background change is honored by Excel when the HTML file is opened; and NOT honored by Excel when the XML file is opened.

You can do some changes in a style template -- but basically, some overrides are just not honored by Excel when you use TAGSETS.EXCELXP -- I believe it is a limitation of how styles are defined/used in the XML.

cynthia
[pre]
ods listing close;
title; footnote;
ods msoffice2k file='c:\temp\test1_mso.xls' style=sasweb;
ods tagsets.excelXP file='c:\temp\test1_xp.xls' style=sasweb
options(absolute_column_width="10");
ods escapechar='^';

proc report data=sashelp.class(obs=3) nowd
style(lines)={background=cyan font_size=18pt};
title '1) background will work in HTML (MSOFFICE2K) but not ExcelXP)';
column name age height weight sex;
compute before / style={just=l protectspecialchars=off background=yellow font_size=14pt};
text1 = "fontsize should be 14pt background color is yellow in HTML only";
line text1 $150.;
endcomp;
compute after;
text2 = 'This is a line with a cyan (default) background in HTML only';
line text2 $150.;
endcomp;
run;
ods _all_ close;

title; footnote;
** 2) Change the template NoteContent style element;
ods path work.tmp(update) sashelp.tmplmst(read);

proc template;
define style styles.linecolor;
parent=styles.journal;
class NoteContent /
foreground=black
background=pink
font_weight=bold
font_size=14pt;
end;
run;

ods msoffice2k file='c:\temp\test2_mso.xls' style=styles.linecolor;
ods tagsets.excelXP file='c:\temp\test2_xp.xls' style=styles.linecolor
options(absolute_column_width="10");
ods escapechar='^';

proc report data=sashelp.class(obs=3) nowd;
title '2) use a custom style template';
column name age height weight sex;
compute before / style={just=l protectspecialchars=off background=yellow font_size=14pt};
text1 = "fontsize should be 14pt background color yellow overrides style in HTML";
line text1 $150.;
endcomp;
compute after;
text2 = 'This is a line using the style template color';
line text2 $150.;
endcomp;
run;
ods _all_ close;
[/pre]
Ask a Question
Discussion stats
  • 1 reply
  • 231 views
  • 0 likes
  • 2 in conversation