BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Blaine7
Calcite | Level 5

I want to left justify one of my column header when running proc report. I refer to the question here:https://communities.sas.com/t5/ODS-and-Base-Reporting/How-Can-I-Make-Header-Justified-Left-Partially.... It is quite familiar to my question. One difference is I want to output a html. The solution works for rtf and pdf. Not works for html. 

 

Here is my example code:

data test;
length column1-column3 $200.;
column1="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; column2="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb "; column3="cccccccccccccccccccccccccccccccccccccccccccccccccc "; output;
run;

ods html file="****";
ods escapechar='~';
proc report data=test nowindows style(header)={just=c};
column ('aaaaa' column1 ('~S={just=l} bbbb' column2) ('~S={just=r} cccc' column3));
define column1 / display;
define column2 / display;
define column3 / display;
run;
ods HTML close;

 

Any suggestion would be appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Try Traffic Light Format.

 

 

data test;
length column1-column3 $200.;
column1="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; column2="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb "; column3="cccccccccccccccccccccccccccccccccccccccccccccccccc "; output;
run;

proc format;
value $ fmt
'bbbb'='l'
'cccc'='r'
other='c'
;
run;

ods escapechar='~';
proc report data=test nowindows style(header)={just=$fmt. };
column ('aaaaa' column1 ('bbbb' column2) ('cccc' column3));
define column1 / display;
define column2 / display;
define column3 / display;
run;

Ksharp_1-1678798029689.png

 

View solution in original post

7 REPLIES 7
Hao_Luo
SAS Employee

This may works:

ods escapechar='~';
proc report data=test nowindows style(header)={just=c};
column ('aaaaa' column1 ('~S={just=l width=300%}bbbb' column2) ('~S={just=r width=300%}cccc' column3));
define column1 / display;
define column2 / display;
define column3 / display;
run;

Have no idea about the reason and feel pity about that. I may back to complete this.

Blaine7
Calcite | Level 5
Hi Luo, thanks for your response. I didn't see any difference with the code you provided. Did that work on your SAS console?
Hao_Luo
SAS Employee

Yes, I am using SAS 9.4 TS1M8.

2.png

Hao_Luo
SAS Employee
Just a quick try in SAS EG, this trick failed >_<
Blaine7
Calcite | Level 5
Yes. I am using SAS studio and it failed either.
Ksharp
Super User

Try Traffic Light Format.

 

 

data test;
length column1-column3 $200.;
column1="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; column2="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb "; column3="cccccccccccccccccccccccccccccccccccccccccccccccccc "; output;
run;

proc format;
value $ fmt
'bbbb'='l'
'cccc'='r'
other='c'
;
run;

ods escapechar='~';
proc report data=test nowindows style(header)={just=$fmt. };
column ('aaaaa' column1 ('bbbb' column2) ('cccc' column3));
define column1 / display;
define column2 / display;
define column3 / display;
run;

Ksharp_1-1678798029689.png

 

Blaine7
Calcite | Level 5
It works. Thanks a lot.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 7 replies
  • 1215 views
  • 1 like
  • 3 in conversation