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

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);

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

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:

Cynthia_sas_0-1679667235343.png

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

View solution in original post

4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi: You don't show all your code or your ODS statements. What is your ODS destination of interest? ODS HTML, RTF, PDF, EXCEL???
Cynthia
Amine_Khemiri
Obsidian | Level 7

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;

Cynthia_sas
SAS Super FREQ

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:

Cynthia_sas_0-1679667235343.png

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

Amine_Khemiri
Obsidian | Level 7

Thanks Cynthia ! It works !!

 

Kind regards,

Amine

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 464 views
  • 1 like
  • 2 in conversation