I will admit that I was intimidated by PROC TEMPLATE when I first started diving into the Output Delivery System (ODS) world. I was told that I needed to create a custom style template to get the stylized output that I wanted, but I did not know where to begin. PROC TEMPLATE contains many style elements and style attributes and I did not know what went where. The further I got into ODS and PROC TEMPLATE the more comfortable I got. And you will too.
To begin learning about custom style templates I recommend that you:
- Determine the default style template for the destination you use the most, PDF, HTML, etc. The documentation contains a table with the default style template and recommended SAS-supplied style templates for each ODS destination.
- Choose the procedure (or two) that you use the most and write a step that includes most of the features of that procedure that you use on a regular basis.
- Make one small attribute change at a time and run your test program to see what changed.
Working through these recommendations for PROC REPORT, I searched the documentation and found a section on the style elements used by the procedure . The main style elements for PROC REPORT are Header and Data. The Table, DataEmphasis, and LineContent style elements are used as well. I use the ODS PDF destination a lot and I know the default style template for PDF in SAS 9.4 is Styles.Pearl.
In my test program the PROC REPORT step has multiple columns, a summary row, and a line of text. The PROC TEMPLATE code makes one change to the header style element and one change to the data style element. The new style template, named styles.pdfrep, is referenced in the ODS PDF statement.
proc template; define style styles.pdfrep; parent=styles.pearl; class data / backgroundcolor=lightcyan; class header / fontsize=18pt; end; run; ods pdf file="test.pdf" style=styles.pdfrep; proc report data=sashelp.cars; column origin type invoice msrp; define origin / group; define type / group; break after origin /summarize; compute before origin; line origin $10. 'Section'; endcomp; run; ods pdf close;
The resulting table has a larger font size for the header section of the table and a background color for the data rows of the table.
This example is small and makes changes to just two style attributes. PROC TEMPLATE can do a lot more and you can create a custom style template with many more customizations. The full list of attributes that can be changed are in this Style Attributes Table . Try any of the attributes that you think you need to get the output that you want. I recommend using bright colors, thick borders, and large font sizes to be sure you can clearly see if the change was made. Once you know you are changing the right place you can then change the values to more desirable colors and sizes.
For more examples of controlling styling in PROC REPORT tables in the common ODS destinations, check out my book The SAS® Programmer's PROC REPORT Handbook: ODS Companion .