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.
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;
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.
Yes, I am using SAS 9.4 TS1M8.
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;
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!
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.