BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
karolisb
Fluorite | Level 6

Hello there,

I'm starting to work with proc report and I have some troubles with manipulating layout.

b.png

Code:

data test;

input a $ b c @@;

datalines;

a 1 11 b 2 22 c 3 33

;

run;

title1 "Test";

proc report data=test;

column ("Section"(a))

        ("Another section"("Subsection"(b c))) ;

define a / group;

define b / group;

define c / group;

run;

And what I'm looking for is:

b.png

Is it possible with proc report? Or would you recomend tabulate? I'm not very familar with proc tabulate, so any help with proc report would very be very apreciated

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

HI:

  You did not mention your destination of interest. Is it RTF, PDF, HTML? You show the standard HTMLBLUE style, which is generally HTML output.
      

  The issue with PROC REPORT is that it will not make the header cell for column A span 2 rows in HTML or PDF. As RW9 shows, you might be able to cause spanning with RTF control strings. But the bottom line is that PROC REPORT makes each report row, including the header rows 1 row at a time. The reason the RTF solution might work is that RTF renders differently than output is rendered in the browser or in PDF.
     

  For HTML or PDF, this may be the best you can do (move section up and put a blank on the same row as subsection):

ods html file="c:\temp\span.html"  ;

   

proc report data=sashelp.class nowd;

  columns ("Section" (" " name)) ("Another Section" ("Subsection" sex age)) ;

  define name / "a"  ;

  define sex / 'b';

  define age / 'c';

run;

      

ods html close;

cynthia

View solution in original post

11 REPLIES 11
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

Well, with a bit of fidling you should be abel to get it right.  This shows putting RTF code into the text:

ods escapechar="^";

ods rtf file="s:\temp\rob\z.rtf" style=statistical;

proc report data=sashelp.class nowd;

  columns ("Demo" name) ("^R'\brdrb\brdrs\brdrw15 'Demo" sex age) height weight;

  define name / " " style(header)=[just=c bordertopcolor=white];

run;

ods rtf close;

Depends a bit on your output destination.  Have a look through the style documentation, here is an example: http://support.sas.com/resources/papers/stylesinprocs.pdf

You may need to combine a few things.

Cynthia_sas
SAS Super FREQ

HI:

  You did not mention your destination of interest. Is it RTF, PDF, HTML? You show the standard HTMLBLUE style, which is generally HTML output.
      

  The issue with PROC REPORT is that it will not make the header cell for column A span 2 rows in HTML or PDF. As RW9 shows, you might be able to cause spanning with RTF control strings. But the bottom line is that PROC REPORT makes each report row, including the header rows 1 row at a time. The reason the RTF solution might work is that RTF renders differently than output is rendered in the browser or in PDF.
     

  For HTML or PDF, this may be the best you can do (move section up and put a blank on the same row as subsection):

ods html file="c:\temp\span.html"  ;

   

proc report data=sashelp.class nowd;

  columns ("Section" (" " name)) ("Another Section" ("Subsection" sex age)) ;

  define name / "a"  ;

  define sex / 'b';

  define age / 'c';

run;

      

ods html close;

cynthia

Ksharp
Super User

OK. If you need proc report so badly, here is a workaround i.e. change the html source code directly . Hope you like it.

It is appeared that SAS Forum will eat some character of my code . Download the attachment if you need .

d.png

c.png

Xia Keshan

Message was edited by: xia keshan

Message was edited by: xia keshan

karolisb
Fluorite | Level 6

Thanks for respond.

I've tried your method, but it seems it doesn't work as expected :?

a.png

Ksharp
Super User

Did you open  c:\temp\want.html  ?

karolisb
Fluorite | Level 6

yes I did

Ksharp
Super User

Got what you want now ?

karolisb
Fluorite | Level 6

Look above what I've got, It's from .html... Somehow it looks different from yours.

Ksharp
Super User

That is weird . When I open c:\temp\want.html , it display the graph I posted .

Are you sure you open c:\temp\want.html ?

Ksharp
Super User

Are you using University Edition ? Try this one . This time should be worked.

Cynthia_sas
SAS Super FREQ

Hi, keep in mind that DATA _NULL_ output will not automatically "pop open" in a Results Window. So you will have to go outside of SAS to a browser or to Windows Explorer and explicitly find the WANT.HTML file and open it. Depending on how your Internet cache settings are defined, you may want to give it a new, unique name, so that you are not pulling up a cached copy without the spanning.

cynthia

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 11 replies
  • 1900 views
  • 3 likes
  • 4 in conversation