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;
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.