BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
KentaMURANAKA
Pyrite | Level 9

Hi, there:

 

 

I would like to make only part of headers ("AAAAA" in my example) justified left by using PROC REPORT.

I tried to use inline formatting, but my following code does not generate what I want, remains unchanged (center justified, in default?).

data test;
    length column1-column3 $200.;
    column1="aaaaa"; column2="bbbbb"; column3="ccccc"; output;
run;
ods rtf file="PleaseSpecifyYourOwnFolder\test.rtf";
proc report data=test nowindows;
    column ("(*ESC*){style[fontfamily='Times New Roman' just=left]AAAAA}" column1 ("BBBBB" column2) ("CCCCC" column3));
    define column1 / display;
    define column2 / display;
    define column3 / display;
run;
quit;
ods rtf close;

ex.PNG

I have no idea. Please help me.

Thank you in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
heffo
Pyrite | Level 9

Try style(header)={just=l} on the proc report line:

proc report data=test nowindows style(header)={just=l};
    column ("(*ESC*){style[fontfamily='Times New Roman' just=left]AAAAA}" column1 ("BBBBB" column2) ("CCCCC" column3));
    define column1 / display;
    define column2 / display;
    define column3 / display;
run;

View solution in original post

5 REPLIES 5
heffo
Pyrite | Level 9

Try style(header)={just=l} on the proc report line:

proc report data=test nowindows style(header)={just=l};
    column ("(*ESC*){style[fontfamily='Times New Roman' just=left]AAAAA}" column1 ("BBBBB" column2) ("CCCCC" column3));
    define column1 / display;
    define column2 / display;
    define column3 / display;
run;
KentaMURANAKA
Pyrite | Level 9

Hi, heffo-san:

 

 

Your code works.

Thank you.

 

I have one more question.

I think, your code's style(header)=xx effects overall headers, but result is not (only for top header "AAAAA").

I misunderstand? Any reference info is welcome.

Thank you in advance.

KentaMURANAKA
Pyrite | Level 9

Hi, heffo-san, All:

 

 

Sorry, but one problem,

Following your code, almost all headers, "AAAAA"~"CCCCC" are left justified.

I want lower headers, "BBBBB" & "CCCCC" to remain unchanged (i.e., center justified).

Please help me. Thank you in advance.

heffo
Pyrite | Level 9

Could this work:

ods escapechar='^';
ods rtf file="\\FMAWPDFP02\Home$\henrik.forsell\test2.rtf";
proc report data=test nowindows style(header)={just=l};
	column ('aaaaa' column1 ('^S={just=c} bbbb' column2) ('^S={just=c} cccc' column3));
    define column1 / display;
    define column2 / display;
    define column3 / display;
run;
quit;
ods rtf close;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 5 replies
  • 2779 views
  • 3 likes
  • 2 in conversation