BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi there,

I am looking for a posibility to merge PDF report cells
vertically, like in MS Excel. I am using PROC REPORT.
Does anybody know, is it possible?

Thanks in advace.
Romas
7 REPLIES 7
Tim_SAS
Barite | Level 11
Can you explain more about what you're looking for?
deleted_user
Not applicable
I am looking for a way, how I can generate PDF (by using PROC REPORT) with merged cells, as in the following HTML:










COL1
COL2
SUB1COL2
SUB2COL2
A
B1
B2



Regards
Romas
Cynthia_sas
SAS Super FREQ
Romas:
See if this gives you what you want:
[pre]
ods html file='c:\temp\mergeheaders.html' style=sasweb;
proc report data=sashelp.class nowd;
column ('Span All' ('Hdr 1' name)
('Hdr 2' age height)
('Hdr 3' weight));
define name /order;
define age /display;
define height /display;
define weight /display;
run;
ods html close;
[/pre]
The key is putting the quoted string BEFORE the variables that you want it to span. After you run the above code, then modify the COLUMN statement to have this:
[pre]
column ("Span All" ( name)
('Hdr 2' age height)
('Hdr 3' weight));
[/pre]
and you will see that there is now an "empty" header cell above the NAME column. If you wanted 'Hdr 2' to span NAME, AGE and HEIGHT, then you'd have to move the NAME column into the parentheses for 'Hdr 2'.

cynthia
deleted_user
Not applicable
Thank You for the answer, but this does not solve my problem.
Question was how to span cells vertically.
Suppose that I want to have Hdr1 and Name merged togather like a one cell.

Regards
Romas
Cynthia_sas
SAS Super FREQ
Sorry, I focussed on the header spanning horizontally. If you use the split character, you can "stack" strings into a header cell. So, for example, this would put the string 'Hdr1' above NAME, 'Hdr2' above AGE, etc: [pre]
ods html file='c:\temp\mergeheaders2.html'
style=sasweb;
proc report data=sashelp.class nowd
split='/';
column ('Span All' (name age height weight));
define name /order 'Hdr1 /Name';
define age /display 'Hdr2 /Age';
define height /display 'Hdr3 / Height';
define weight /display '/Weight';
run;
ods html close;
[/pre]

But, it is harder to merge cells vertically. So if you used the above technique to put 'Hdr1' above NAME, but you used the previous technique to have 'Hdr2' span both AGE and HEIGHT, you would then find an empty cell on the same row as the 'Hdr2' string -- that empty cell would be above NAME and WEIGHT. It's better, in my experience, to use the above technique to stack strings into header cells. If you do use this technique, then you might also need to set the style attribute for vertical justification, so that all the Header text was at the bottom of the cell. That way, you would not have single line text strings floating to the top of the cell. The way to change the style attribute in this way is: [pre]
proc report data=sashelp.class nowd split='/'
style(header)={vjust=b};[/pre]

I am not aware of any other technique to merge header cells vertically in PROC REPORT. PROC REPORT writes out every report row -- a single row at a time. In the HTML that's written for the NAME cell in the above program output, SAS is NOT writing out an HTML "rowspan" attribute, it is writing out the following HTML:[pre]
Hdr1
Name
[/pre] with a
tag substituted for the SPLIT character. For the "Span All" header (shown above), SAS is writing out HTML with a "colspan" attribute [pre]
Span All[/pre]
If you customized or wrote your own HTML tagset, using PROC TEMPLATE, there might be a way for you to modify the default HTML that is being written. You can find out more information on using PROC TEMPLATE to write your own MARKUP language tagset by visiting the sites below:
http://support.sas.com/rnd/base/topics/odsmarkup/
http://support.sas.com/rnd/base/topics/odsmarkup/pandp.html

cynthia
deleted_user
Not applicable
Thank You for the answer.
I will be waiting for such possibility in a future
releases.

Cheers
Romas
Duong
Obsidian | Level 7
Hi Romas

I know that this was post a while ago but I would like share that you can do vertical cell merging (if you are prepare to do post-processing). I have done this with RTF but not yet
in PDF. If you do a proc tabulate then you will probably see that the top left corner cells are vertically merged. Just open the output file and study the RTF/PDF codes and post-process according.

Why not use the RTF format instead then convert your RTF file to PDF. There are free
software to do this conversion. I think the RTF format would be easier to post-processing
but then again I know very little about the PDF format at the moment.

Here are some papers on what you can do with ODS RTF.

http://www.tranz.co.uk

click on the download button.


Regards
Duong

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 7 replies
  • 1907 views
  • 0 likes
  • 4 in conversation