I would like to make only part of headers ("CTCAE" in my example) justified left and keep "Last Value Assessed" center justified by using PROC REPORT.
Thanks in advance for your help.
PROC REPORT data=reportDSN missing nowindows split='@'
style(header)=[just=c]
style(report)=[outputwidth=100% rules=group frame=hsides background=white font_size=9pt]
style(column)=[rules=group font_size=9pt] spanrows;
columns pagebreak grp ("CTCAE" stat1) stat2 ("Last Value Assessed"_1 _2 _3 _4 _5 _99);
Hi:
Thanks for the information. However, without data, it is impossible to use or run your example. Although, knowing that you were using ODS RTF is useful. The only way I know to do what you want is to make some "fake" headers by using helper variables that you create in a SAS dataset, as shown below:
The helper variables are CTHDR and LVHDR and each variable just contains the text string that you want to use as a spanning header. Then, I add those helper variables into the PROC REPORT COLUMN statement using the , operator, which indicates that their usage will be set to ACROSS in the DEFINE statement. Once these helper variables have their own DEFINE statement, I can change the justification for each one as needed. I'm showing the RTF file opened in WORD and in print preview, so you can see that the outputwidth stretches from margin to margin.
Hope this gets you closer to what you want.
Cynthia
Hi Cynthia,
Here is a more complete code. ODS destination is rtf format.
Thanks for checking.
Kind regards,
Amine
ods rtf file="&path.\table 1.rtf";
/* Proc report */
PROC REPORT data=reportDSN missing nowindows split='@'
style(header)=[rules=group frame=above verticalalign=top background=white
font_size=9pt just=l] style(report)=[outputwidth=100% rules=group frame=hsides
background=white font_size=9pt] style(column)=[rules=group font_size=9pt]
spanrows;
columns pagebreak grp ("CTCAE" stat1) stat2 ("Last Value Assessed"_1 _2 _3 _4 _5 _99);
define pagebreak/ order order=data noprint;
define grp / order order=data noprint;
define stat1 / "Treatment" display style(column)=[width=2.5cm asis=on just=l]
style(hdr)=[asis=on just=l];
define stat2 / "Baseline" display style(column)=[width=1.5cm just=l]
style(hdr)=[asis=on just=l];
define _1 / "<=Grade I^nn(%)" display style(column)=[width=1.5cm
just=c] style(hdr)=[asis=on just=c];
define _2 / "Grade II^nn(%)" display style(column)=[width=1.5cm just=c]
style(hdr)=[asis=on just=c];
define _3 / "Grade III^nn(%)" display style(column)=[width=1.5cm just=c]
style(hdr)=[asis=on just=c];
define _4 / "Grade IV^nn(%)" display style(column)=[width=1.5cm just=c]
style(hdr)=[asis=on just=c];
define _5 / "Missing^nn(%)" display style(column)=[width=1.5cm just=c]
style(hdr)=[asis=on just=c];
define _99 / "Total^nn(%)" display style(column)=[width=1.5cm just=c]
style(hdr)=[asis=on just=c];
break after pagebreak /page;
compute before grp;
line ' ';
endcomp;
RUN;
ods rtf close;
Hi:
Thanks for the information. However, without data, it is impossible to use or run your example. Although, knowing that you were using ODS RTF is useful. The only way I know to do what you want is to make some "fake" headers by using helper variables that you create in a SAS dataset, as shown below:
The helper variables are CTHDR and LVHDR and each variable just contains the text string that you want to use as a spanning header. Then, I add those helper variables into the PROC REPORT COLUMN statement using the , operator, which indicates that their usage will be set to ACROSS in the DEFINE statement. Once these helper variables have their own DEFINE statement, I can change the justification for each one as needed. I'm showing the RTF file opened in WORD and in print preview, so you can see that the outputwidth stretches from margin to margin.
Hope this gets you closer to what you want.
Cynthia
Thanks Cynthia ! It works !!
Kind regards,
Amine
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.