The SAS Output Delivery System and reporting techniques

help:ods to rtf problem

Reply
N/A
Posts: 0

help:ods to rtf problem

proc template;
define style styles.newstyle;
parent = styles.rtf;
replace table from output /
frame = hsides ;
replace body from document /
bottommargin = 19.8 mm
topmargin = 30 mm
rightmargin = 20.1 mm
leftmargin = 38.1 mm;
end;

run;

data test;
input sex treatment result n;
cards;
1 1 1 40
1 1 2 80
1 2 1 100
1 2 2 50
;
run;

ods rtf file="e:/temp.rtf" style=styles.newstyle;
proc report data=test nowd;
column sex treatment result n;
define sex/display;
define treatment/display;
define result/display;
define n/display;
compute after / style(lines)=[just=l cellwidth=20 mm];;
line 'this is table notes';
endcomp;
run;
ods rtf close;

submit the code, got a table like the below:

___this is the title___
sex treatment result n
1 1 1 40
1 1 2 80
1 2 1 100
1 2 2 50
this is table notes

what i want is make the table notes "this is the table note" below the line,like the table below,how can i do this , thank you very much!

___this is the title___
sex treatment result n
1 1 1 40
1 1 2 80
1 2 1 100
1____2____2___50
this is table notes
SAS Super FREQ
Posts: 8,868

Re: help:ods to rtf problem

Posted in reply to deleted_user
Hi:
My suggestion would be to take the COMPUTE block out of your Proc Report. Your template specification of HSIDES is working as designed. The COMPUTE block LINE statement goes "inside" the boundary of the table. So the table is not finished until AFTER your LINE statement.

However, if you used ODS RTF TEXT= instead of the COMPUTE block, then you would get the the line under the last row of data in the table and your TEXT= string would be underneath the line.

This would mean that your style template would need to have the USERTEXT style element defined:[pre]
replace usertext from usertext/
just=c
font_weight=bold;[/pre]

but then your code would look like what's shown below. You might have to fiddle with the width and justification for the USERTEXT element, because it is now OUTSIDE of the table. In SAS 9.2, you'll be able to set the border top style separately from the other border styles, so you will use a different method in SAS 9.2 to change the interior table borders.
cynthia
[pre]
*** the code;
ods rtf file='c:\temp\test.rtf' style=newstyle;
proc report code; *<-- TAKE OUT COMPUTE BLOCK FOR LINE;
run;
ods rtf text='This is table notes';
ods rtf close; [/pre]
N/A
Posts: 0

Re:

Posted in reply to Cynthia_sas
You are a good person!!!

Thank you veeeery much!
Ask a Question
Discussion stats
  • 2 replies
  • 118 views
  • 0 likes
  • 2 in conversation