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, All:

 

 

I am trying to generate output like this in RTF Output, which has one merged cell (Column No.2 + Column No. 3)

ex1.PNG

I think nested structure in column statement is one of solutions, but I do not know how to write code.

I attached example code. Please help me.

Thank you in advance.

data test;
    length column1-column3 $200.;
    column1="aaaaa"; column2="bbbbb"; column3="ccccc"; output;
run;
ods rtf file="SpecifyYourFolder\test.rtf";
proc report data=test nowindows
    style(header)={backgroundcolor=white fontweight=light fontsize=8pt fontfamily="Times New Roman"}
    style(report)={rules=groups frame=hsides borderwidth=0.5pt bordercolor=black}
    ;
    column
        column1
        (
        "BBB+CCC" column2 column3
        )
    ;
    define column1 / display "AAAAA";
    define column2 / display "";
    define column3 / display "";
run;
quit;
ods rtf close;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Consider

 

proc report data=test nowindows
    style(header)={backgroundcolor=white fontweight=light fontsize=8pt fontfamily="Times New Roman"}
    style(report)={rules=groups frame=hsides borderwidth=0.5pt bordercolor=black}
    ;
    column
        ("AAAAA" column1)
        
        ("BBB+CCC" column2 column3 )
            ;
    define column1 / display "" ;
    define column2 / display "";
    define column3 / display "";
run;
quit;

Mixing the way you define the column headings between DEFINE and COLUMN statements is adding the additional row,

View solution in original post

2 REPLIES 2
ballardw
Super User

Consider

 

proc report data=test nowindows
    style(header)={backgroundcolor=white fontweight=light fontsize=8pt fontfamily="Times New Roman"}
    style(report)={rules=groups frame=hsides borderwidth=0.5pt bordercolor=black}
    ;
    column
        ("AAAAA" column1)
        
        ("BBB+CCC" column2 column3 )
            ;
    define column1 / display "" ;
    define column2 / display "";
    define column3 / display "";
run;
quit;

Mixing the way you define the column headings between DEFINE and COLUMN statements is adding the additional row,

KentaMURANAKA
Pyrite | Level 9

Hi, ballardw-san:

 

 

Thank you for your quick reply. Your code worked for me.

Yes, I had trouble with additional row that I do not intend.

Thanks to your explanation, I understand.

 

 

Thank you for giving details!!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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