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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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