Break line

Reply
N/A
Posts: 0

Break line

Dear All,

Could u pl tell anyone how to get the break line between treatments and merging cells of treatments in rtf report like below.

_________________________
|Treatment | Visit | n (%) |
|__________|______|________|
| | Visit 1 | xx(xx.x) |
|Treatment1 |______ |_______ |
| | VIsit 2 | xx(xx.x) |
|__________|______|________|
|_________________________|
| | Visit 1 | xx(xx.x) |
|Treatmentt2 |______ |_______ |
| | VIsit 2 | xx(xx.x) |
|__________ |______|________|

Thanks in advance...

SSN Ravi
N/A
Posts: 0

Re: Break line

Sorry...

It did not display properly. To understand properly I am giving explanation below.

There are 3 columns (Treatment, Visit and n(%) respectively) in the rtf report.
There are 2 Treatments (Treatment1 and Treatment2) in the treatment column.
There are 3 Visits (Visit1, Visit2 and Visit3) in the Visit column.

See the output for this code.

proc report data=temp nowd;
column treatment visti n1;
define treatment/ group order=data;
define visit/ display order=data;
define n1/display;
break after trt/skip summarize suppress;
run;

1) I want to get the break line after the treatment without any virtical lines in the
blank line.
2) There will be 3 rows for each treatment. Treatment1 is displaying In the first row
and remaining row treatment cells are blank. But I want to merge those 3
Treatment cells into single cell.

If u dont understand pl give ur mail id i will send u the rtf file.

Thanks in advance...

SSN Ravi
SAS Super FREQ
Posts: 8,815

Re: Break line

Hi:
If you want "lined up" text to display properly, you have to surround the text with (pre) and (/pre) --
except where I have ( you would use [ and where I have ), you would put ] This will work just like the <pre> tag in HTML, except for the forum you have to use [ and ]

For example, you don't see the [ pre ] and [ /pre ] below -- but everything will be lined up when viewed in the forum posting window:
[pre]
_________________________________
|Treatment | Visit | n (%) |
|__________ |______ |________ |
| | Visit 1 | xx(xx.x) |
|Treatment1 |______ |_______ |
| | VIsit 2 | xx(xx.x) |
|__________ |______ |________ |
|________________________________|
| | Visit 1 | xx(xx.x) |
|Treatment2 |______ |_______ |
| | VIsit 2 | xx(xx.x) |
|__________ |______ |________ |
[/pre]

So, to answer your question ... the new SPANROWS option would accomplish the "merged" columns that you want for Treatment1 and Treatment2. This works in SAS 9.2 -- but not in earlier releases.

Next, it seems to me that all your variables are character or being treated as character, so the SUMMARIZE option in the BREAK statement isn't appropriate. Also, the SKIP option is ignored for ODS HTML, ODS RTF and ODS PDF (SKIP is what you'd use in LISTING to get a blank line) . For ODS destinations, you need a COMPUTE block to skip a line:

[pre]
compute after treatment;
line ' ';
endcomp;
[/pre]

If you have SAS 9.2, the code would be as shown below. If you only have SAS 9.1.3, the PROC REPORT statement would be:
[pre] proc report data=temp nowd; [/pre]

cynthia

[pre]
** SAS 9.2 code;
ods listing close;
ods rtf file='c:\temp\visit.rtf';
proc report data=temp nowd spanrows;
column treatment visit n1;
define treatment/ order order=data
style(column)={vjust=m};
define visit/ display order=data;
define n1/display;
** break after treatment / summarize suppress;
compute after treatment;
line ' ';
endcomp;
run;
ods rtf close;
[/pre]
N/A
Posts: 0

Re: Break line

Hi Cynthia,

Thanks for your quick replay.

But iam getting the break line at the end of report also.
I want the break line only after each group of treatment variable but not at the end of report.

Thank&Regards,
SSN Ravi
SAS Super FREQ
Posts: 8,815

Re: Break line

Hi:
The "COMPUTE AFTER TREATMENT" block executes at the end or "bottom" of EVERY unique value for TREATMENT, including the one at the end of the report. You cannot get a line between each value for TREATMENT without getting one at the end of the REPORT as well. This is one of the ways that PROC REPORT operates. The LINE statement cannot be executed conditionally -- it always writes in the location specified. You can control -what- it writes (the text that gets written out), but you will always get a line at the end of the report, because that's where the end of the last unique value of TREATMENT is.

cynthia
N/A
Posts: 0

Re: Break line

Hi,

Could u pl suggest me any alternate procedure to not to get the break line at the end of the report.

Thanks,

SSN
SAS Super FREQ
Posts: 8,815

Re: Break line

Hi:
There are no alternate procedures -- PROC PRINT and PROC TABULATE give you less control over breaking than PROC REPORT because they do not have COMPUTE blocks.

Your only choices are to post process the RTF file to get rid of that last blank line (either manually delete and resave the file -- or write a Word macro to delete the line). Or, to use DATA _NULL_ and FILE PRINT ODS to write the report to ODS RTF -- consult the ODS documentation for more information on this technique. There's also an e-lecture that contains information about DATA _NULL_ and ODS: https://support.sas.com/edu/schedules.html?id=443&ctry=US

cynthia
N/A
Posts: 0

Re: Break line

Hi,

We are using SAS 9.1.3.
I have used rows_span option in ODS Region statement. But Iam unable to get it.
So could you pl guide me how to get the row spanning in SAS 9.1.3.

Thanks in advanse...

SSN
SAS Super FREQ
Posts: 8,815

Re: Break line

Hi:
ODS Region would affect ALL of the PROC REPORT output -- not row-spanning within PROC REPORT itself. I don't see how ODS Region will help you.
If you are trying to use ODS REGION and ODS LAYOUT with the experimental DATA step interface to ODS, you might need to work with Tech Support on your question, as I have not worked much with this experimental feature (still experimental in SAS 9.2, by the way).

Again, in SAS 9.2, PROC REPORT has the SPANROWS option, and there is no way to duplicate that look in PROC REPORT syntax in SAS 9.1.3.

Your only choices are:
1) Once your RTF file was created, you would have to open the file in Word, manually merge cells and then resave the file as a Word doc. Or,

2) post-process your RTF file -- if and only if -- you find out what the proper RTF control strings are to do row spanning, then you could either manually edit the RTF file to get rid of the control strings that ODS uses for the rows and substitute the RTF control strings that you want, or you could write a program to post process the RTF file. Please note that to post process the RTF file you need a high comfort level and understanding of RTF control strings, because mismatched { or } or \ commands could render the RTF file unreadable.

cynthia
Ask a Question
Discussion stats
  • 8 replies
  • 654 views
  • 0 likes
  • 2 in conversation