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
SAS Super FREQ
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!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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