BookmarkSubscribeRSS Feed
mcook
Quartz | Level 8

In the following code, i have a pretext to appear above the table. 

If Run as is, it centers the pretext above the table, with the table in the center of the page.

If 'Just=Left' is uncommented, the pretext appears where I want it in relation to the table. But it does this only by left justifying the table, and pretext, to the left of the page. 

Is it possible to get the pretext to be left justified to the table itself, regardless of the position of the table on the page? 

 

ods rtf file="C:\FilePath\TestRTF.rtf";
ODS escapechar='^';
options nodate nonumber;
proc report data=SASHELP.Class spanrows split='~'

Style(Report) = [Rules=Rows Frame=HSides 
					pretext='Table1.1 Temp Title'
/*					just=left*/
					font=('Times New Roman', 12pt, bold)];

Column Sex Name Age Height Weight;
Define Sex / Group Center style(column)=[Vjust=Center];
Define Name / style=[borderleftwidth=1pt] 
				style(Header)=[borderleftwidth=1pt borderleftcolor=black
								borderrightwidth=1pt	borderrightcolor=graybb ]
				Display 'Student~Name'
				CENTER;
Define Age /  style=[borderrightwidth=1pt]
				style(Header)=[borderleftwidth=1pt borderleftcolor=graybb 
								borderrightwidth=1pt borderrightcolor=black]
								style(Column)=[CellWidth=0.70in]
								display
				CENTER ;
Define Height / Style(Column)=[CellWidth=0.75in]
				style(Header)=[borderrightcolor=graybb borderleftcolor=black]
				CENTER;
Define Weight / Style(Column)=[CellWidth=0.75in] 
				style(Header)=[borderleftcolor=graybb borderrightcolor=black]
				display '^{style[fontstyle=italic]Weight}^'
				CENTER;
run;
ods rtf close;
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
My tendency would be to use COMPUTE BEFORE _PAGE_ / style={just=c} or to use a TITLE or to use ODS RTF TEXT= -- all of which provide ways for you to control the style of the text you write out. PRETEXT is harder to control.

Cynthia
mcook
Quartz | Level 8
will any of those options allow me to have the text 'attached' to the table? So that when the table is copied and pasted to another location, the title will go along with it?
Cynthia_sas
SAS Super FREQ
If that's what you want, then I would recommend COMPUTE BEFORE _PAGE_.
Cynthia
Jianmin
Obsidian | Level 7

Hi @Cynthia_sas and @mcook , 

 

It looks like @Cynthia_sas has a solution for @mcook 's request, but a simple solution for this one would be something like a change in your code: 

pretext='\ql Table1.1 Temp Title\line'

The control word \ql will put the title line on the left, while \qr will do the right alignment.  You guess it, \qc will do the center alignment, but that would be default for PRETEXT.  I also took the liberty of adding a line of space between the title line and the table, which is achieved by  the control word \line.  You can have more space by adding more \line, or none by deleting it completely. 

 

Many Thanks

Jianmin Long

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 994 views
  • 0 likes
  • 3 in conversation