BookmarkSubscribeRSS Feed
Kastchei
Pyrite | Level 9
Hello!

I am looking to left justify a spanning header in proc report using RTF. The lowest header I can get left justified by doing:

define labTest / order style = [just = l] 'Laboratory Test';

However, I cannot get something similar for a spanning header. I've tried the code below and it does not work (for me). ` is my escape character.

columns ('`{style [just=left] Baseline Result}' baseInd fuInd);
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi:
I can think of 2 methods:
1) Left-justify the default for ALL headers, including the spanning header, in the PROC REPORT statement and then in the DEFINE statement, change the ones you do NOT want left justified;

2) use COMPUTE BEFORE _PAGE_ with a style override for the justification -- this will span ALL the columns in the column statement -- not just 2 columns, however.

cynthia
[pre]
ods listing close;

ods rtf file='c:\temp\usestyle1.rtf';
title "1) Justify ALL the Headers Left and then change the ones you do NOT want left-just";
proc report data=sashelp.class nowd
style(header)={just=l};
column ('BaseLine Results' age name) height weight;
define age / order style(header)={cellwidth=1.25in} 'Laboratory Test';
define name / display style(header)={cellwidth=1.25in} 'The Name';
define height / display style(header)={just=c cellwidth=1.25in};
define weight / display style(header)={just=c cellwidth=1.25in};
run;
ods _all_ close;

ods rtf file='c:\temp\usecompute2.rtf';
title "2) Use COMPUTE BEFORE";
proc report data=sashelp.class nowd
style(header)={just=l};
column age name height weight;
define age / order style(header)={cellwidth=1.25in} 'Laboratory Test';
define name / display style(header)={cellwidth=1.25in} 'The Name';
define height / display style(header)={just=c cellwidth=1.25in};
define weight / display style(header)={just=c cellwidth=1.25in};
compute before _page_/ style=Header{just=l};
line 'BaseLine Results';
endcomp;
run;
ods _all_ close;
[/pre]

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 7213 views
  • 3 likes
  • 2 in conversation