BookmarkSubscribeRSS Feed
Defense
Obsidian | Level 7

I am using proc report to generate report then output with ODS RTF. In the expected report (attached) column “Location” include four rows. We expect row1” Total # of Participants in the country” be align left, while other rows (City1, City2 and City3) to be on CENTER.

 

Question:

Is there any way to align some rows left and some rows center in one column using proc report?

4 REPLIES 4
ballardw
Super User

@Defense wrote:

I am using proc report to generate report then output with ODS RTF. In the expected report (attached) column “Location” include four rows. We expect row1” Total # of Participants in the country” be align left, while other rows (City1, City2 and City3) to be on CENTER.

 

Question:

Is there any way to align some rows left and some rows center in one column using proc report?


Show the code for proc report and reference which elements need which alignment. Style overrides can be specified for each element and even conditionally with a little work. But guessing which variable and what not is kind of problematic.

Defense
Obsidian | Level 7

ods rtf file="&outdir\Table1.rtf";

 

title1 'Table XX';

title2 'Members by Country and City ';

 

proc report data=table NOWD;

column Location All;

define Location /"Location" style=[cellwidth=1 in font =("Arial",8) just=c];

define All /display "All" style=[cellwidth=1 in font =("Arial",8) just=c];

run;

 

ods rtf close;

Reeza
Super User

This shows how to colour the cells but the STYLE can also include the alignment/justification. 

This is know as conditional formatting.

 

http://support.sas.com/kb/23/353.html

 


@Defense wrote:

ods rtf file="&outdir\Table1.rtf";

 

title1 'Table XX';

title2 'Members by Country and City ';

 

proc report data=table NOWD;

column Location All;

define Location /"Location" style=[cellwidth=1 in font =("Arial",8) just=c];

define All /display "All" style=[cellwidth=1 in font =("Arial",8) just=c];

run;

 

ods rtf close;


 

Defense
Obsidian | Level 7
Thanks. Code has been posted. Variable "Location" row 1 need to alignment to left, while row2-4 need to be alignment to center
Thanks

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
  • 4 replies
  • 1801 views
  • 0 likes
  • 3 in conversation