BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
2 REPLIES 2
Cynthia_sas
Diamond | Level 26
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]
deleted_user
Not applicable
You are a good person!!!

Thank you veeeery much!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 975 views
  • 0 likes
  • 2 in conversation