Force right or left justification of a footnote or title based upon the LINESIZE= option's value.
Note: When the system option CENTER is specified, the output data and global statement text will be centered. This method will allow you to center the data and dynamically right or left justify a footnote or title.
If using ODS, see How can I left- or right-justify my titles or footnotes?
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.
/* Read text string from DATALINES. To right justify the string, */
/* position it in a character string so that the last byte is at */
/* the last position of the linesize setting from the LINESIZE= */
/* system option. The character variable is then copied into a macro */
/* variable R_NOTE. Character strings align to the left by default, */
/* so create the macro variable L_NOTE without adding any leading */
/* spaces. */
/* */
/* Note: The length of the NOTE variable should be at least the */
/* length of the LINESIZE system variable. The informat used to read */
/* the NOTE variable in the INPUT statement must be long enough */
/* to include the entire text of the title or footnote. */
options nonumber nodate symbolgen center ps=30 ls=100;
data _null_;
infile datalines truncover;
length jnote note $100;
input note $50. ;
/* Determine the number of spaces needed to pad NOTE to right justify */
/* the value of NOTE */
spaces=(input(getoption('ls'),8.) - length(note))-1;
/* Pad NOTE and assign the result into JNOTE */
jnote=repeat(' ',spaces)||note;
/* Create a macro variable to resolve in a left justified TITLE */
/* and a macro variable to resolve in a right justified FOOTNOTE */
call symput('r_note',jnote);
call symput('l_note',note);
datalines;
This is the text string I want to justify
;
title "&l_note";
footnote "&r_note";
proc print data=sashelp.class;
run;
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 is the text string I want to justify Obs Name Sex Age Height Weight 1 Joyce F 11 51.3 50.5 2 Thomas M 11 57.5 85.0 3 Jane F 12 59.8 84.5 4 Louise F 12 56.3 77.0 5 James M 12 57.3 83.0 6 John M 12 59.0 99.5 7 Robert M 12 64.8 128.0 8 Alice F 13 56.5 84.0 9 Barbara F 13 65.3 98.0 10 Jeffrey M 13 62.5 84.0 11 Carol F 14 62.8 102.5 12 Judy F 14 64.3 90.0 13 Alfred M 14 69.0 112.5 14 Henry M 14 63.5 102.5 15 Janet F 15 62.5 112.5 16 Mary F 15 66.5 112.0 17 Ronald M 15 67.0 133.0 18 William M 15 66.5 112.0 19 Philip M 16 72.0 150.0 This is the text string I want to justify
Type: | Sample |
Topic: | SAS Reference ==> DATA Step Common Programming Tasks ==> Utilities Query and Reporting ==> Creating Reports ==> Non Graphical |
Date Modified: | 2008-07-09 16:35:22 |
Date Created: | 2004-09-30 14:09:08 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | Base SAS | All | n/a | n/a |