Hi there,
I produce a lot of tables with multiple header rows using either proc report or proc tabulate. I use a custom template which produces the following output header:
However, what I want directly from the SAS output is the following:
Currently I do this "by hand" in Microsoft Word. However I would like to know if there is a way to do it directly in SAS. I found this page - http://support.sas.com/kb/46/022.html - but as far as I understand, this is applicable to individual cells of the table and not in the header. Does anyone know how to customize this, either on proc report/tabulate or on SAS styles?
Regards,
David
If you are referring to headers that span columns of other variables you may have to be very careful in defining exactly what you want. Borders affect an entire cell and in Proc tabulate can be addressed with the CLASSLEV statement. But since it appears that your only want to display a "border" for part of a cell then you really do not have a border. At least other cells on that row do not appear in your example.
You might be able to get a similar affect by using bordertopwidth that varies with the calues of what you display as Var1 similar to traffic highlighting but I doubt that is going to be a simple generic solution.
You might try suppressing the bottom border entirely
Hi ballardw,
I currently have this specification for the header within proc template:
style header / fontfamily="Times New Roman" fontsize=12pt fontweight=bold borderbottomwidth=0.5pt bordertopwidth=0.5pt textalign=left verticalalign=middle height=0.39in;
Do you suggest that I remove the borders and mannually add them using proc report or proc tabulate? Or have I misunderstand? How should I do that?
Regards
Since it appears that you want to do a lot of by-cell appearance changes then you may want to set all of the header top and bottom widths to 0 and then use style overrides in the table construction where it affects the header values.
OR
Leave you current Ods style as it is for bottom widths and then use style overrides for the spanning header to remove the borders that you don't want.
Another potential option but likely to be hard to maintain is take a simple table that you have modified in Word. Save it as RTF and see if you can find the RAW rtf codes to do what you want. You possibly could then use Escapechar and the RAW predicate with the cell contents to get the behavior you want. I am not saying that will be trivial or easy to maintain but might work.
Hi:
I would tend to do this with the text_decoration style attribute, as shown below....using PROC REPORT and ODS ESCAPECHAR in the spanning header.
cynthia
Hi Cynthia,
That option just subscript the word and does not "create" a bottom border. Thank you for the answer, but it will not work as a solution to me 🙂
Regards,
David
Post the data you used in the form of a datastep and the code you used that generated a subscript instead of an underline.
Already found a solution using proc report:
ods escapechar="£";
proc report data=work._tmp;
columns ('£S={borderbottomcolor=black}' VAR1)
('Group VAR', VAR2.1, VAR2.2)
('£S={borderbottomcolor=black}' VAR3);
define VAR1 / group noprint style(header)={borderbottomwidth=0.5};
define VAR2.1 / group noprint style(header)={borderbottomwidth=0.5 bordertopwidth=0.5};
define VAR2.2/ group noprint style(header)={borderbottomwidth=0.5 bordertopwidth=0.5};
define VAR3 / group noprint style(header)={borderbottomwidth=0.5};
run;
And by changing the custome style I've created by setting the default borders to 0 on the Header block and putting top aod bottom borders on the Table block.
Thank you all for the help aod really helpful suggestions.
Regards,
David
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.
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.