BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,
When using ODS listing we can create grouped headers like following,
Sex/Age/ Serum Pregnancy Test
Ethnicity/ ——————————————
Race* Date Result**
See the "serum pregnancy test" is at the same row as the 'Sex/age/'

If you do this in ODS RTF, it will become something like this:
Serum Pregnancy Test
______________
Sex/Age/
Ethnicity/
Racea Date Result

See how the 'serum pregnancy test' and its underline is above 'sex/age/' row. Sometimes this make the output very ugly.
Is there any way to change this behavior to something like the first example? Appreciate your help.
Stephen
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi: This may not be an ODS RTF issue, so much as an issue with the Procedure that you're using. For example, PROC REPORT has some options that are supported in the LISTING destination, but are ignored in the HTML, PDF -and- RTF destinations. Same with PROC TABULATE.

What code/procedure are you using to create your report??? Can you duplicate the issue using the SASHELP.CLASS or SASHELP.SHOES data -- so you don't have to post your data to the forum? If so, folks are more able to help if you send the code that is in question.

cynthia
deleted_user
Not applicable
Cynthia,
Thank you so much for your prompt reply, here is the code that generates both lising-style output and rtf output using proc report. see the deffirence how the headers are alligned. Thanks a lot.

*using listing destination;
proc printto file='c:\temp.txt' new;
run;
proc report data=sashelp.shoes nowd split = '|' missing;
column region product stores ("Revenue|______" sales returns);
define stores/'Number|of|stores';
define sales/width=10 'Sales';
define returns/width=15 'Returns';
run;
proc printto;
run;

*using rtf destination;
ods listing close;
ods rtf file='c:\temp.rtf';
proc report data=sashelp.shoes nowd split = '|' missing;
column region product stores ("Revenue|___________" sales returns);
define stores/'Number|of|stores';
define sales/style(column)=[cellwidth=1.2 in] 'Sales';
define returns/style(column)=[cellwidth=1.2 in] 'Returns';
run;
ods rtf close;
ods listing;
Cynthia_sas
SAS Super FREQ
Hi:
This is what I see from the LISTING output:
[pre]
Number Revenue
of ___________________________
Region Product stores Sales Returns
Africa Boot 12 $29,761 $769
Africa Men's Casual 4 $67,242 $2,284
Africa Men's Dress 7 $76,793 $2,433
[/pre]

The word Revenue is on the same "line" with the word Number. The underline is on the same "line" with the word OF and Sales and Returns are on the same line with Stores. The UNDERSCORE line spans the -entire- column for sales and the -entire- column for returns. This is a feature specific to LISTING -- certain characters are consider 'repeating' characters and they cause that character to repeat for the width of what they span.

But that's the way that the LISTING window works with PROC REPORT. ODS RTF does not use "repeat" characters. So what I see in the ODS RTF output is that the line of underscores only appears underneath word 'REVENUE'. This is an apples versus oranges kind of thing. RTF is NOT LISTING. But I do see, in the RTF file, that the cell for REVENUE spans both the cells for SALES and RETURNS.

I would be tempted to abandon the LISTING technique. Writing a physical row of underscores takes up an extra line of space and, to me, doesn't look very nice. (But that's my opinion.)

In SAS 9.2, using the bordertopcolor and bordertopwidth attributes, I can change the border of SALES and RETURNS so the output has the -appearance- of being underlined (using style=journal, so you can see the underlining effect in Print Preview mode). Otherwise, you might have to use RTF control strings in your headers to get the underlining you want. In this instance, your best bet for help would be to work with Tech Support.

cynthia
[pre]
title;
ods listing close;
*using rtf destination;
ods listing close;
ods rtf file='c:\temp\temp2.rtf' style=journal;

proc report data=sashelp.shoes nowd split = '|' missing;
column region product ("Number of" stores) ("Revenue" sales returns);
define stores/'stores';
define sales/style(column)=[cellwidth=1.2 in] 'Sales'
style(header)={bordertopcolor=black bordertopwidth=2pt};
define returns/style(column)=[cellwidth=1.2 in] 'Returns'
style(header)={bordertopcolor=black bordertopwidth=2pt};
run;
ods rtf close;
ods listing;
[/pre]
deleted_user
Not applicable
Cynthia, Thanks again for your detailed information. I guess I can use your method under certain circumstances, but not other. For example, if I have two groups of headers next to each other, the topborder will be connected together making it impossible to separate. Also, If I have too many variables like 'store' where I need to manually specify the text on top of the header, it will be troublesome.
I guess for now, I have to live with the fact that ODS RTF handle this differently.
Thanks again.

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
  • 4 replies
  • 821 views
  • 0 likes
  • 2 in conversation