The SAS Output Delivery System and reporting techniques

Proc Report, column headers w/ data in the same line

Reply
Regular Contributor
Regular Contributor
Posts: 170

Proc Report, column headers w/ data in the same line

Hello all,
Curious to know if it feasible to have the column header in the same line as the data point, so that instead of:

Name
Lawrence

You would have Name: Lawrence

Multiple names are not a problem here as a macro must output a single report for each event.

Thank you for your time.

Lawrence
SAS Super FREQ
Posts: 8,868

Re: Proc Report, column headers w/ data in the same line

Hi:
Would you want the column header to still look like a column header??? If you had more than 1 obs would you want EVERY obs to have the column header for EVERY var?? Like this:
[pre]
Name: Alfred Age: 16
Name: Barb Age: 15
Name: Carl Age: 16
[/pre]

What is your destination of interest??? HTML, RTF, PDF???

What PROC REPORT gives you by default is the NAMED option. It has a particular look and feel, but it does put the COLUMN header into EVERY report cell. But rather than a colon, it uses an = by default.

cynthia
[pre]
ods listing;
ods html file='c:\temp\shownamed.html' style=sasweb;
proc report data=sashelp.class nowd named ls=100;
run;
ods _all_ close;
[/pre]
Regular Contributor
Regular Contributor
Posts: 170

Re: Proc Report, column headers w/ data in the same line

Posted in reply to Cynthia_sas
Cynthia-
Thank you that works!
However that leads to 2 more questions-
How can I get rid of that "box" around the variable
AND
is there is a way to change the paramter of how much space follows after a report-
I am "stacking" proc reports that will be exported onto a RTF document.

So that there is:
Proc report=data.x
Proc report=data.y

but I don't want the space between them or at least minimize it.
Thanks again!


Lawrence
SAS Super FREQ
Posts: 8,868

Re: Proc Report, column headers w/ data in the same line

Hi:
Well, that "box" around each variable is the interior table line or border at the top, bottom and sides of each cell, controlled by the RULES style attribute (and the frame around the entire table is controlled by the FRAME style attribute).

You could try other STYLE= options.But since you said you were interested in RTF, the best style without any interior table lines for RTF is the JOURNAL style, which you would specify as:
[pre]
ods rtf file='c:\temp\showstyle.rtf' style=journal;
[/pre]

You might not need to use the STYLE(REPORT) override, if you like the way that JOURNAL looks by default. If you wanted to remove ALL interior table lines, you can also try:
[pre]
ods rtf file='c:\temp\shownamed.rtf';
proc report data=sashelp.class nowd named
style(report)={rules=none frame=void cellspacing=0};
run;
ods _all_ close;
[/pre]


The other way to minimize space is to turn off titles between each step:
[pre]
title 'First Proc Report';
proc report data=x;
run;

title;
proc report data=y;
run;
[/pre]

I assume that you have already discovered STARTPAGE=NO with ODS RTF to get as much onto a page as possible.

Also, for the original ODS RTF the default amount of space between tables is 2 or 4 carriage returns (and I think you get a section break between each output). I do not believe that behavior can be changed. However, for the new ODS TAGSETS.RTF destination, you can change a style attribute called PARSKIP, as described here:
http://support.sas.com/rnd/base/new92/92measuredrtf.html

and with an example in this previous forum posting:
http://support.sas.com/forums/thread.jspa?threadID=12610

cynthia
Regular Contributor
Regular Contributor
Posts: 170

Re: Proc Report, column headers w/ data in the same line

Posted in reply to Cynthia_sas
Cynthia;
Will take a stab at it. Thanks for your assistance again.
~Lawrence
Super User
Posts: 10,035

Re: Proc Report, column headers w/ data in the same line

I like to use proc report + line statement.



Ksharp
Regular Contributor
Regular Contributor
Posts: 170

Re: Proc Report, column headers w/ data in the same line

Posted in reply to Cynthia_sas
Cynthia;
The parameters of rules=none frame=void cellspacing=0 seem to work for HTML output but not for RTF. I am sure that I can set the parameters in a template somewhere?
The journal template did not want to play ball either with RTF outputs..

Lawrence
Regular Contributor
Regular Contributor
Posts: 170

Re: Proc Report, column headers w/ data in the same line

Posted in reply to Cynthia_sas
Cynthia:
An FYI-I had consulted SAS technical support on the gridlines-
They had none and this may be a byproduct of the version of Microsoft??

Very interesting indeed.

Lawrence
SAS Super FREQ
Posts: 8,868

Re: Proc Report, column headers w/ data in the same line

Hi, Lawrence:
Yes, it is a puzzlement.

Here's what I know. If I submit this code in SAS 9.2
[pre]
ods rtf file='c:\temp\usejournal.rtf' style=journal;
proc print data=sashelp.class(obs=5);
run;
ods rtf close;
[/pre]

and open the resulting file using Word 2010, I see the following:
-- No interior table lines, except for 1 border line above the header row, 1 border line between the header row and the data and 1 border line under the last obs.
-- All output is Black and White (no gray scale)

If I use this code:
[pre]
ods rtf file='c:\temp\usedefault.rtf' style=rtf;
proc report data=sashelp.class(obs=5) nowd
style(report)={rules=none frame=void cellspacing=0};
run;
ods rtf close;
[/pre]

Then I see the following (again, SAS 9.2 and Word 2010):
-- no interior table lines, no frame around the table
-- header cells are gray background with black foreground, all other cells are black and white

If you had told me that Excel was not respecting STYLE=JOURNAL, I would totally understand -- Excel is wonky with interior table lines and borders that come from SAS -- output will look one way in a browser and look totally different in Excel. But I have been using these particular style overrides with SAS and ODS RTF since ODS RTF first came out and STYLE overrides were supported (that was a LONG time ago).

If you run the code above, you should see similar results. If you were using a word processor other than Word (such as Open Office or Star Office, then the interior lines might be an issue). But I have been using these types of overrides as far back as Office 2000 with ODS RTF and have NEVER had issues such as you report.

So I'm not sure what's up with your system. Working with Tech Support is the way to go. However, I will respectully disagree with the statement that the style overrides "seem to work for HTML output but not for RTF". There would be no point in making a template change if it's not working in STYLE overrides. The attributes that you would change in a template would be the exact same attributes that aren't working in STYLE overrides.

cynthia
Regular Contributor
Regular Contributor
Posts: 170

Re: Proc Report, column headers w/ data in the same line

Posted in reply to Cynthia_sas
Cynthia;
Talking with tech support def gives rise that this may be a problem with my stsem somewhere as they had no issue either. I'll simply try at home and see what happens there as well and see if that make a difference. It makes no sense at all.

In the interim, I will continue w/ the "boxes" until I get to the bottom of this.
And yes I stand corrected or rather I amend the statement of
"seem to work for HTML output but not for RTF" to
"seem to work for HTML output but not for RTF on my system.

Thanks again for your help.

Lawrence
Ask a Question
Discussion stats
  • 9 replies
  • 390 views
  • 0 likes
  • 3 in conversation