A SAS macro toolkit to showcase layout patterns using PROC ODSTABLE. Provides reusable examples of table design with multi-level headers, conditional formatting, composite layouts, and auto-generated RTF output. Ideal for clinical reporting, style template development, and training use.
Purpose : Showcase of PROC ODSTABLE layout patterns with RTF output generator
- Generates multi-patterned tables with custom headers/footers
- Demonstrates cell merging, grouping, pagination, and style templates
- Designed for instructional, reference, and reusable reporting workflows
Usage :
%odstable_layoutshowcase(outpath=..., sampleno=1~4);
Outputs :
- RTF file(s) with pre-defined table layout samples
- Corresponding template and macro code as .txt for inspection
%odstable_layoutshowcase(sampleno=1);
Multiple Variables in a Single Cell:
When multiple variables are output into the same cell, they are enclosed in parentheses to visually group them together.
Line Breaks in Header Labels:
Line breaks within header text can be defined using a custom delimiter specified by the split= option (e.g., #), allowing for clean vertical formatting.
Hierarchical Header Structure:
Header levels are built by stacking multiple define header statements, where each level is defined by its corresponding start= and end= variable range. This approach enables clear and layered multi-row headers.
%odstable_layoutshowcase(sampleno=2);
~~~sas
%odstable_layoutshowcase(sampleno=3);
~~~
Conditional Styling with cellstyle:
Borders can be applied conditionally using syntax like
cellstyle condition as data{borderbottomwidth=1}, enabling precise control over table appearance based on data values.
Page Breaks via PRETEXT:
You can insert page breaks programmatically using PRETEXT="(ESC)R'\pagebb'", which outputs an RTF escape sequence before the target cell.
Targeting Specific Rows or Columns:
The example also demonstrates the use of row and col in condition expressions, showing how to selectively apply styles to specific rows or columns in the table layout.
%odstable_layoutshowcase(sampleno=4);
Composite Layout within a Single Report:
By specifying startpage=no in the ODS RTF statement, multiple tables can be rendered within a single RTF page flow, enabling composite layouts in one report.
Footnote Area Adjustment Using a Gap Column:
The example demonstrates how to define a gap column to reserve space for footnotes in the second table.
This ensures consistent layout and prevents footnotes from overlapping with table content
0.1.0(30July2025): Initial version
The package is built on top of SAS Packages Framework(SPF) developed by Bartosz Jablonski.
For more information about the framework, see SAS Packages Framework.
You can also find more SAS Packages (SASPacs) in the SAS Packages Archive(SASPAC).
First, create a directory for your packages and assign a packages fileref to it.
filename packages "\path\to\your\packages";Secondly, enable the SAS Packages Framework. (If you don't have SAS Packages Framework installed, follow the instruction in SPF documentation to install SAS Packages Framework.)
%include packages(SPFinit.sas)Install SAS package you want to use with the SPF's %installPackage() macro.
-
For packages located in SAS Packages Archive(SASPAC) run:
%installPackage(packageName)
-
For packages located in PharmaForest run:
%installPackage(packageName, mirror=PharmaForest)
-
For packages located at some network location run:
%installPackage(packageName, sourcePath=https://some/internet/location/for/packages)
(e.g.
%installPackage(ABC, sourcePath=https://github.com/SomeRepo/ABC/raw/main/))
Load SAS package you want to use with the SPF's %loadPackage() macro.
%loadPackage(packageName)