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 YTD | 2014 Final Results | |||
LOB | # | $ | # | $ |
I wanted to remove the first row which contains "id_cross" and Have "LOB" in a merged cell, like below.
LOB | 2015 YTD | 2014 Final Results | ||
# | $ | # | $ |
FYI, I'll have the output in a pdf file eventually.
Many thanks in advance,
dm
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
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.
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 |
|
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;
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 |
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.
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 |
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
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.
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
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.
but the empty line is still there...
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
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
thanks everyone, all the answers are very helpful. really appreciate your time and help.
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!
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.