BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

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

View solution in original post

2 REPLIES 2
Ksharp
Super User

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

statistician13
Quartz | Level 8

Yes, I forgot about the ods escapechar option.  Thanks so much!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 4609 views
  • 1 like
  • 2 in conversation