BookmarkSubscribeRSS Feed
Robert_Bardos
Fluorite | Level 6
Experimenting with tagsets.tableeditor I want to have two tables side by side each having their own caption_text. Following is the (stripped down) code:
[pre]
title ;
ods tagsets.tableeditor file="&test_path/sample_tbled.html"
encoding='OPEN_ED-1047' /* remove if not running on z/OS */
options(panelcols='2');
ods tagsets.tableeditor options(caption_text='Girls') ;
proc print data=sashelp.class (where=(sex='F')) noobs ;
var name age ;
run;
ods tagsets.tableeditor options(caption_text='Boys') ;
proc print data=sashelp.class (where=(sex='M')) noobs ;
var name age ;
run;
ods tagset.tableeditor close ;
[/pre]
Net effect: table 1 has the caption 'Girls', table 2 has the stacked caption 'Girls Boys'. Any ideas how to solve this?

TIA
Robert
(PS: tested with SAS 9.1.3 and 9.2 on z/OS)
5 REPLIES 5
Cynthia_sas
SAS Super FREQ
Hi:
You might have to work with Tech Support to see whether this is a known issue. However, in the meantime, if you switch to PROC REPORT with a spanning header, you do not need to use caption_text at all.

cynthia
[pre]
title ;
ods tagsets.tableeditor file="c:\temp\sample_tbled_alt.html"
options(panelcols='2' doc='help');
proc report data=sashelp.class (where=(sex='F')) noobs ;
column ('koala' name age );
run;

proc report data=sashelp.class (where=(sex='M')) noobs ;
column ('wombat' name age );
run;
ods tagset.tableeditor close ;

[/pre]
Robert_Bardos
Fluorite | Level 6
Thanks Cynthia,

this get's me closer to the desired result. Basically I want the first header line of the tables in different colors (let's say the 'koala' cell with a green background and the 'wombat' cell with a yellow background. Now if you happen to have a solution for this as well, that would just be great!

Greetings from Berlin
Robert
Cynthia_sas
SAS Super FREQ
Hi, Robert:
STYLE= overrides to the rescue. The first STYLE= override (for HEADER) in the PROC REPORT statement is the color you want the spanning header (Koala or Wombat). Then the STYLE= overrides for NAME and AGE headers are set in the DEFINE statement. And, of course, the NOOBS from PROC PRINT should change to NOWD in the PROC REPORT statement.

If you wanted NAME and AGE to be the SAME color, then you'd have to use the technique shown for the boys' table and if you wanted NAME and AGE to be DIFFERENT colors, then you'd have to use the technique shown for the girls' table. No guarantees what will happen if you open the file with something other than a browser -- should be OK in Word, might be OK in Excel. Notice that I added STYLE=SASWEB to the ODS invocation statement -- this means that the statement level changes will override the style settings that are coming from the SASWEB style template. This type of STYLE= override syntax works with PROC REPORT, PROC PRINT and PROC TABULATE. (slightly different syntax for each procedure -- many examples in user group papers) -- as shown in these papers:
http://www2.sas.com/proceedings/sugi28/015-28.pdf
http://www.lexjansen.com/pharmasug/2010/sas/sas-hw-sas02.pdf
and this one, which discusses using style overrides to perform traffic lighting of cell values:
http://www2.sas.com/proceedings/sugi31/142-31.pdf

cynthia
[pre]
title ;
ods tagsets.tableeditor file="c:\temp\sample_tbled_alt.html"
options(panelcols='2' doc='help') style=sasweb;
ods escapechar='^';
proc report data=sashelp.class (where=(sex='F')) nowd
style(header)={background=pink};
column ('koala' name age );
define name / style(header)={background=purple};
define age / style(header)={background=cx666666};
run;

proc report data=sashelp.class (where=(sex='M')) nowd
style(header)={background=blue};
column ('wombat' name age );
define name / style(header)={background=cx666666};
define age / style(header)={background=cx666666};
run;
ods tagset.tableeditor close ;

[/pre]
Robert_Bardos
Fluorite | Level 6
Thanks again Cynthia,

had found the solution this very moment as well.

The exercise had been motivated by an Excel "report" which we want to replace by a HTML intranet report. So getting as close as possible to the original is highly desired.

Kind regards
Robert
Cynthia_sas
SAS Super FREQ
Hi:
You might also investigate TAGSETS.HTMLPANEL if you're sticking with reports that will be opened in a browser -- and only in a browser -- slightly different syntax than TAGSETS.TABLEEDITOR -- but with less JavaScript embedded in the HTML.

cynthia

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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