BookmarkSubscribeRSS Feed
nj_sas
Calcite | Level 5
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
1 REPLY 1
Cynthia_sas
SAS Super FREQ
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]

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 860 views
  • 0 likes
  • 2 in conversation