Sample 42377: Create a hanging indent in the ODS RTF destination
The ODS RTF destination allows the use of RTF control words. This functionality adds additional formatting control beyond the SAS® style attributes documented in Style Attributes and Their Values.
The Full Code tab shows the use of the SAS style attribute PRETEXT to use the PNHANG (paragraph hanging indent) RTF control word, along with the RTF control words \fiN (first line indent, which is a negative value in the sample code), and \liN, left indent. N is a twips value. An additional column shows a column with left indention, using only \liN.
The ODS RTF destination supports the Rich Text Format (RTF) Specification, version 1.7. It is documented here if you need reference for the control word syntax: Index of RTF Control Words.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
The sample code uses raw RTF formatting to demonstrate a hanging indent and left indent. The style attribute CELLWIDTH is used to force the text to wrap. The style attribute PROTECTSPECIALCHARS is set to off so that the special characters are interpreted as part of the RTF language. The PRETEXT values are RTF-specific control words.
/***************************************************************************************************/
/* The example below shows the use of the SAS style attribute PRETEXT to use the PNHANG */
/* (paragraph hanging indent) RTF control word, along with the RTF control words \fiN */
/* (first line indent, which is a negative value in the sample code), and \liN, left indent. */
/* N is a twips value. An additional column shows a column with left indention, using only \liN */
/* A twip is one-twentieth of a point. 1440 twip = 1 inch. */ */
/* *************************************************************************************************/
title;
options nodate nonumber;
data test;
length x y $ 100 ;
x="A very long text string for which we will demonstrate a HANGING
indent in the RTF output file.";
y="A very long text string for which we will demonstrate a LEFT
indent in the RTF output file.";
output;
run;
ods listing close;
ods rtf file="indents.rtf";
proc report nowd data=test;
define x / "Hanging indent" style(column)={cellwidth=2in
protectspecialchars=off
pretext='\pnhang\fi-220\li220 '};
define y / "Left Indent" style(column)={cellwidth=2in
protectspecialchars=off
pretext='\li220 '};
run;
ods rtf close;
ods listing;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample illustrates how to create a hanging indent in the ODS RTF destination.
Date Modified: | 2021-11-12 12:36:44 |
Date Created: | 2011-02-13 13:53:38 |
Operating System and Release Information
SAS System | Base SAS | z/OS | 9.1 TS1M3 SP4 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows XP 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Advanced Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Professional | 9.1 TS1M3 SP4 | |
Microsoft Windows NT Workstation | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows XP Professional | 9.1 TS1M3 SP4 | |
Windows Vista | 9.1 TS1M3 SP4 | |
Windows Vista for x64 | 9.1 TS1M3 SP4 | |
64-bit Enabled AIX | 9.1 TS1M3 SP4 | |
64-bit Enabled HP-UX | 9.1 TS1M3 SP4 | |
64-bit Enabled Solaris | 9.1 TS1M3 SP4 | |
HP-UX IPF | 9.1 TS1M3 SP4 | |
Linux | 9.1 TS1M3 SP4 | |
Linux on Itanium | 9.1 TS1M3 SP4 | |
OpenVMS Alpha | 9.1 TS1M3 SP4 | |
Solaris for x64 | 9.1 TS1M3 SP4 | |
Tru64 UNIX | 9.1 TS1M3 SP4 | |