The SAS Output Delivery System and reporting techniques

manipulating proc report layout

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 11
Accepted Solution

manipulating proc report layout

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


Accepted Solutions
Solution
‎01-05-2015 02:42 PM
SAS Super FREQ
Posts: 8,645

Re: manipulating proc report layout

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


All Replies
Esteemed Advisor
Esteemed Advisor
Posts: 6,726

Re: manipulating proc report layout

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.

Solution
‎01-05-2015 02:42 PM
SAS Super FREQ
Posts: 8,645

Re: manipulating proc report layout

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

Grand Advisor
Posts: 9,332

Re: manipulating proc report layout

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

Attachment
Occasional Contributor
Posts: 11

Re: manipulating proc report layout

Thanks for respond.

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

a.png

Grand Advisor
Posts: 9,332

Re: manipulating proc report layout

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

Occasional Contributor
Posts: 11

Re: manipulating proc report layout

yes I did

Grand Advisor
Posts: 9,332

Re: manipulating proc report layout

Got what you want now ?

Occasional Contributor
Posts: 11

Re: manipulating proc report layout

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

Grand Advisor
Posts: 9,332

Re: manipulating proc report layout

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 ?

Grand Advisor
Posts: 9,332

Re: manipulating proc report layout

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

Attachment
SAS Super FREQ
Posts: 8,645

Re: manipulating proc report layout

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

Post a Question
Discussion Stats
  • 11 replies
  • 831 views
  • 3 likes
  • 4 in conversation