Can anyone tell me if there is an equivalent of the split character option from proc report in proc tabulate to break header labels at predefined characters in proc tabulate?
For example, in proc report you could write something like proc report data=mydata split="*"; and then when you specified a column header as "This is*my column*header" the column would appears as follows:
This is
my column
header
Thanks for your help.
Can't use ods escapechar ?
options nodate;
data fundrais;
length name $ 8 classrm $ 1;
input @1 team $ @8 classrm $ @10 name $
@19 pencils @23 tablets;
sales=pencils + tablets;
datalines;
BLUE A ANN 4 8
RED A MARY 5 10
GREEN A JOHN 6 4
RED A BOB 2 3
BLUE B FRED 6 8
GREEN B LOUISE 12 2
BLUE B ANNETTE . 9
RED B HENRY 8 10
GREEN A ANDREW 3 5
RED A SAMUEL 12 10
BLUE A LINDA 7 12
GREEN A SARA 4 .
BLUE B MARTIN 9 13
RED B MATTHEW 7 6
GREEN B BETH 15 10
RED B LAURA 4 3
;
run;
proc format;
picture pctfmt low-high='009.99 %';
run;
ods escapechar='~';
ods html file='c:\temp\rename_across_headers_with_report.html';
proc tabulate data=fundrais format=9.;
title '1) TABULATE';
class team classrm;
var sales;
table (team all),
classrm='Classroom ~n tabulate'*sales=' '*(sum colpctsum*f=pctfmt.)
all*sales*sum=' ';
run;
ods html close;
Xia Keshan
Can't use ods escapechar ?
options nodate;
data fundrais;
length name $ 8 classrm $ 1;
input @1 team $ @8 classrm $ @10 name $
@19 pencils @23 tablets;
sales=pencils + tablets;
datalines;
BLUE A ANN 4 8
RED A MARY 5 10
GREEN A JOHN 6 4
RED A BOB 2 3
BLUE B FRED 6 8
GREEN B LOUISE 12 2
BLUE B ANNETTE . 9
RED B HENRY 8 10
GREEN A ANDREW 3 5
RED A SAMUEL 12 10
BLUE A LINDA 7 12
GREEN A SARA 4 .
BLUE B MARTIN 9 13
RED B MATTHEW 7 6
GREEN B BETH 15 10
RED B LAURA 4 3
;
run;
proc format;
picture pctfmt low-high='009.99 %';
run;
ods escapechar='~';
ods html file='c:\temp\rename_across_headers_with_report.html';
proc tabulate data=fundrais format=9.;
title '1) TABULATE';
class team classrm;
var sales;
table (team all),
classrm='Classroom ~n tabulate'*sales=' '*(sum colpctsum*f=pctfmt.)
all*sales*sum=' ';
run;
ods html close;
Xia Keshan
Yes, I forgot about the ods escapechar option. Thanks so much!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.