BookmarkSubscribeRSS Feed
JaySwan
Calcite | Level 5

Proc Report ODS Format Question

I need to have the text “Header I Want In Merged Row” in a merged cell (Or new row) that spans the entire table(s) of 4 columns.

The text “Header I Want To Span Var1 and Var1” should only span the two columns Var1 and Var2.

Like this:

_______________________________________Header I Want In Merged Row________________________________

             Header I want to Span Var1 and Var2           Header I want to Span Var1 and Var2

       Var1           Var2                                     Var1             Var2

Here is the code I am using, right now the first two text lines are showing up under the 2 columns.

ods layout start columns=2;

option center;

ods region;

/* First Table */

proc report data=XXX split='*' nowd

  style(header)=[backgroundcolor=#FAF3D4 foreground=Black just=center   ];

  column (“Header I Want In Merged Row**Header I Want To Span Var1 and Var1' Var1 Var2 ) ;

  define Var1 / style(column) = {cellwidth=1.5in just=center  }

                 style(header)= {cellwidth=1.5in just=center background=white foreground=black };

  define Var2 / style(column)= {cellwidth=1.5in just=center }

                     style(header)= {cellwidth=1.5in just=center  background=white foreground=black };

run;

/* Second Table */

ods region;

proc report data=XXX split='*' nowd

  style(header)=[backgroundcolor=#FAF3D4 foreground=Black just = center ];

  column ((“Header I Want In Merged Row** Header I Want To Span Var1 and Var3' Var1 Var3) ;

  define Var1 / style(column) = {cellwidth=1.5in just=center  }

                 style(header)= {cellwidth=1.5in just=center background=white foreground=black  };

  define Var3 / style(column)= {cellwidth=1.5in just=center }

                     style(header)= {cellwidth=1.5in just=center  background=white foreground=black };

run;

ods layout end;

TIA..

J

1 REPLY 1
NN
Quartz | Level 8 NN
Quartz | Level 8

Hi,

I think what you are looking for is a title before your ods layout...

I cannot test this right now but i remember using something like the below code.

ods escapechar="~";

title "~{style [ just=center] This is my title}"; 

Hope it helps.

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
  • 1 reply
  • 1035 views
  • 0 likes
  • 2 in conversation