Sample 43259: Justifying text with the ODS TEXT= statement
The ODS TEXT= statement allows the
entire string of text to be left, center, or right justified using logic like that described in
SAS Note 8044. If you want to place text between tables with the text in varying left to right justification locations, it is helpful to use PROC REPORT to generate the desired text.
The code on the Full Code tab illustrates this logic.
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.
Because the ODS <destination> TEXT= text can have only one justification set, the sample code below uses PROC REPORT to write text between two PROC PRINT tables in the ODS RTF and ODS PDF destinations. The sample code generates a data set called JUSTIFY that is used by the PROC REPORT step.
/* The JUSTIFY data set contains the text we will left, center, */
/* and right justify in the ODS PDF and ODS RTF destinations. */
data justify;
left="LEFT";
center="CENTER";
right="RIGHT";
output;
run;
title;
options nodate nonumber;
ods rtf file="file.rtf" startpage=no;
ods pdf file="file.pdf" startpage=no notoc;
proc print data=sashelp.cars noobs;
where cylinders=3;
var origin model;
run;
/* NOHEADER removes the COLUMN headers from the table. */
/* OUTPUTWIDTH/CELLWIDTH can be specified on the DEFINE */
/* statement(s) instead for greater control on the */
/* COLUMN level. */
/* RULES= and FRAME= style attributes are used on the */
/* STYLE(REPORT) option to remove the grid lines. */
proc report data=justify nowd noheader
style(report)={outputwidth=100% rules=none frame=void}
style(column)={fontsize=13pt fontweight=Bold};
column left center right;
define left / style={just=l};
define center / style={just=c};
define right / style={just=r};
run;
proc print data=sashelp.cars noobs;
where cylinders=12;
var origin model;
run;
ods _all_ 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.
The ODS TEXT= statement does not allow text to be left, center, and right justified. This sample shows how to work around this for the ODS PDF and ODS RTF destinations.
Date Modified: | 2011-05-20 10:19:31 |
Date Created: | 2011-05-13 10:15:13 |
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 | |