Using ODS absolute layouts to create side-by-side text blocks

Ian Balanzá-Davis
Ian Balanzá-Davis
Altair Employee
edited September 2022 in Altair RapidMiner

The Output Delivery System (ODS) functionality in SAS language programs is used to create formatted output in different file types such as PDF or RTF. You can use ODS absolute layout functionality to arrange blocks of text, graphics and procedure output side-by-side on a PDF page. Absolute layouts provide greater flexibility for the placement of output on the page, and enables you to create structured output for reports, brochures, and so on.

You can structure ODS layouts for PDF files through the ODS LAYOUT ABSOLUTE and ODS REGION statements, which are provided in this release of Altair SLC Analytics.

ODS LAYOUT ABSOLUTE specifies that elements are positioned within the area defined by the statement using absolute positioning. One or more ODS REGION statements can then be defined within that layout regions in which elements, such as images, text and output can be placed. ODS LAYOUT and ODS REGION statements can be nested.

The following example shows how you can place two blocks of text side-by-side, and place a title specified using the TITLE statement with a styled title.

The resulting page looks like this:

image

The ODS statements required to do this are:

OPTIONS NODATE NONUMBER CENTRE         ORIENTATION=PORTRAIT         PAPERSIZE=A4;  OPTIONS BOTTOMMARGIN=0CM         LEFTMARGIN=0CM         RIGHTMARGIN=0CM         TOPMARGIN=0CM;  TITLE;  ODS ESCAPECHAR ="^"; ODS PDF FILE="c:\temp\lo_test.pdf"; ODS LAYOUT ABSOLUTE width=15cm x=3cm;  ODS REGION X=1cm Y=0cm WIDTH=7.25cm; ODS TEXT="^{STYLE [FONT_SIZE=55pt COLOR=black TEXTALIGN=CENTER]}^{style [FONT_SIZE=30pt]Altair SLC}";  ODS REGION X=8.5cm y=0cm WIDTH=4.75cm ODS TEXT="^{STYLE [FONT_SIZE=14pt COLOR=GREY FONT_STYLE=ITALIC TEXTALIGN=LEFT]Demonstrating ODS Absolute Layouts}";  ODS REGION X=0cm Y=5cm WIDTH=9.5cm HEIGHT=2cm; ODS TEXT="^{STYLE [COLOR=grey VJUST=MIDDLE FONT_STYLE=ITALIC FONT_SIZE=12pt]Altair SLC enables you to access multiple data sources, including big data.}";  ODS REGION X=10cm Y=5cm WIDTH=5cm HEIGHT=4.75cm; ODS TEXT="^{STYLE [COLOR=grey VJUST=TOP FONT_SIZE=12pt VJUST=TOP]Use standalone or with enterprise management facilities including data access control and model deployment to on-demand APIs}";  ODS LAYOUT END; ODS PDF CLOSE; 

The ODS LAYOUT ABSOLUTE and ODS LAYOUT END statements define the area to which ODS REGION statements apply. The layout is specified as being 15cm wide and starting 3cm from the left margin. The subsequent regions are placed in this layout area.

The TITLE global statement has been specified with no option. This creates no title on the page, and prevents the default title from being printed. A title can then be defined using ODS.

The title is defined in two ODS REGION statements. One region is defined as starting at 1cm from the left of the layout area (X=1cm) and 0cm from the top (Y=0cm), placing it at the top of the layout area. Another region is defined starting at 8.5cm from the left of the layout area (X=8.5cm) and 0cm from the top (Y=0cm); this places the second region to the right of the first defined region. The widths of the regions are defined so that the text is displayed as required. The text required for the title is entered in these regions using escape character styling.

The two following ODS regions then define the text blocks that are placed side by side on the page:

  • The first defines a text block on the left-hand side, starting 0cm in from the layout margin (X=0cm) and extending to the centre of the layout area (WIDTH=9.5cm).
  • The second defines a text block on the right-hand side that starts 10cm from the left of the layout area, and has a width of 5cm (WIDTH=5cm).

Both text blocks are vertically aligned 5cm from the top of the ODS layout area (Y=5cm). The text blocks therefore appear on the page adjacent to each other.

The text required for both blocks is again entered in these regions using escape character styling.