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!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 3672 views
  • 1 like
  • 2 in conversation