The SAS Output Delivery System and reporting techniques

How to edit the headers of the output

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 6
Accepted Solution

How to edit the headers of the output

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


Accepted Solutions
Solution
‎03-27-2015 10:50 AM
Grand Advisor
Posts: 9,571

Re: How to edit the headers of the output

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


All Replies
Esteemed Advisor
Esteemed Advisor
Posts: 7,203

Re: How to edit the headers of the output

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.

Occasional Contributor
Posts: 6

Re: How to edit the headers of the output

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;

Occasional Contributor
Posts: 6

Re: How to edit the headers of the output

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

Esteemed Advisor
Esteemed Advisor
Posts: 7,203

Re: How to edit the headers of the output

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.

Occasional Contributor
Posts: 6

Re: How to edit the headers of the output

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

SAS Super FREQ
Posts: 8,717

Re: How to edit the headers of the output

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

Esteemed Advisor
Esteemed Advisor
Posts: 7,203

Re: How to edit the headers of the output

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.

SAS Super FREQ
Posts: 8,717

Re: How to edit the headers of the output

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

Super User
Posts: 1,099

Re: How to edit the headers of the output

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
Occasional Contributor
Posts: 6

Re: How to edit the headers of the output

thanks, Jag.

but the empty line is still there...

Solution
‎03-27-2015 10:50 AM
Grand Advisor
Posts: 9,571

Re: How to edit the headers of the output

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

SAS Super FREQ
Posts: 8,717

Re: How to edit the headers of the output

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

Occasional Contributor
Posts: 6

Re: How to edit the headers of the output

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

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 13 replies
  • 912 views
  • 6 likes
  • 5 in conversation