Hello there,
I'm starting to work with proc report and I have some troubles with manipulating layout.
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:
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
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
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.
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
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 .
Xia Keshan
Message was edited by: xia keshan
Message was edited by: xia keshan
Thanks for respond.
I've tried your method, but it seems it doesn't work as expected :?
Did you open c:\temp\want.html ?
yes I did
Got what you want now ?
Look above what I've got, It's from .html... Somehow it looks different from yours.
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 ?
Are you using University Edition ? Try this one . This time should be worked.
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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.