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

Hi,

Does anyone know how to edit the headers of the output from PROC Report? To be more specific, I got the following output.

id_cross
2015 YTD2014 Final Results
LOB#$#$

I wanted to remove the first row which contains "id_cross" and Have "LOB" in a merged cell, like below.

LOB2015 YTD2014 Final Results
#$#$

FYI, I'll have the output in a pdf file eventually.

Many thanks in advance,

dm

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

a Alternative way is to use proc tabulate .

And if your ods destination is HTML , I would suggest you to overwrite the html source  to get any form you want .

Xia Keshan

View solution in original post

13 REPLIES 13
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

Can you post example code of what you are doing and some test data.  I.e. where does LOB come from, is it a column header, and the # and $ etc.

dm_bmo
Calcite | Level 5

Thanks for the quick reply. here are the test data and code:

lob

id_cross

num_walker

raised_total

CC

2014 Final Results

14

1300

CC

2015 YTD

11

  1. 275.05

options missing='-';

PROC REPORT DATA=work.SUMMARY out=work.temp LS=132 PS=60  SPLIT="/" CENTER ;

COLUMN  LOB id_cross, (num total);

DEFINE  LOB / group "LOB" ;

define id_cross / across descending;

DEFINE  num / SUM "#" ;

DEFINE  total / SUM FORMAT= dollar10. "$" ;

rbreak after / summarize;

compute lob;

else if _break_ = "_RBREAK_" then LOB = "Group Total";

endcomp;

RUN;

dm_bmo
Calcite | Level 5

I wanted the output like this:

LOB

2015 YTD

2014 Final Results

#

$

#

$

CC

11

$275

14

$1,300

But it’s now like:

id_cross

2015 YTD

2014 Final Results

LOB

#

$

#

$

AML

11

$275

14

$1,300

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Ah, I will let Cynthia deal with that one.  I personally don't do calculations and such like in proc report, I do them before hand, create a dataset as I want the output to look, then just basic proc report that with some formatting.

dm_bmo
Calcite | Level 5

actually, I tried this way first and got this:

LOB

# 2015

$ 2015

# 2014

$ 2014

CC

11

$275

14

$1,300

which isn't idea either.

The data for this is like:

lob

Num 2015

$ 2015

Num 2014

$ 2014

CC

11

275.05

14

1300

Cynthia_sas
SAS Super FREQ

Thanks!

PROC REPORT will not do "merged" column headers as you want. PROC REPORT writes the report rows one row at a time. So you can suppress the row for ID_CROSS, but you will still see an empty cell above LOB for the 2015/2014 row. TABULATE may do better because the BOX area at the intersection of the row header area and the column header area will span all the column headers that way you want.

cynthia

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Just to note Cynthia, if the output destination is RTF, then you can send out RTF tags to create merged headings/ blanks etc. though this does require knowlege of RTF.  Whilst the OP stated PDF, he could create RTF, then from Word or something print to PDF.

Cynthia_sas
SAS Super FREQ

True. you can do a lot in RTF control strings. But the OP also has LS and PS in their code, which would be ignored by all ODS destinations except LISTING, so I really wasn't sure what the final goal was (especially since there was also an OUT= in the code that didn't make sense).

cynthia

Jagadishkatam
Amethyst | Level 16

Please try , just make the label of id_across to blank like ' '

options missing='-';

PROC REPORT DATA=work.have out=work.temp LS=132 PS=60  SPLIT="/" CENTER ;

COLUMN  LOB id_cross, (num_walker raised_total);

DEFINE  LOB / group "LOB" ;

define id_cross / ' ' across descending;

DEFINE  num_walker / SUM "#" ;

DEFINE  raised_total / SUM FORMAT= dollar10. "$" ;

rbreak after / summarize;

compute lob;

if _break_ = "_RBREAK_" then LOB = "Group Total";

endcomp;

RUN;

Thanks,

Jag

Thanks,
Jag
dm_bmo
Calcite | Level 5

thanks, Jag.

but the empty line is still there...

Ksharp
Super User

a Alternative way is to use proc tabulate .

And if your ods destination is HTML , I would suggest you to overwrite the html source  to get any form you want .

Xia Keshan

Cynthia_sas
SAS Super FREQ

If the destination IS HTML, then options like LS and PS are ignored by ODS destinations. The BOX area is one of the fundamental differences between PROC REPORT and PROC TABULATE. REPORT does not have a big "BOX" or merged cell on the leftmost corner of the output table, but TABULATE does.

Cynthia

  compare_headers_report_vs_tab.png

dm_bmo
Calcite | Level 5

thanks everyone, all the answers are very helpful. really appreciate your time and help.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 13 replies
  • 2803 views
  • 6 likes
  • 5 in conversation