I am using the following data:
data test ;
length section_1
row_1 $ 50
;
section_order_1 = 1 ;
section_1 = "Baseline" ;
row_order_1 = 0 ;
row_1 = "Baseline" ;
output ;
section_order_1 = 1 ;
section_1 = "Baseline" ;
row_order_1 = 1 ;
row_1 = "n" ;
output ;
section_order_1 = 1 ;
section_1 = "Baseline" ;
row_order_1 = 2 ;
row_1 = "Mean (SD)" ;
output ;
section_order_1 = 1 ;
section_1 = "Baseline" ;
row_order_1 = 3 ;
row_1 = "Median" ;
output ;
section_order_1 = 1 ;
section_1 = "Baseline" ;
row_order_1 = 4 ;
row_1 = "Q1, Q3" ;
output ;
section_order_1 = 1 ;
section_1 = "Baseline" ;
row_order_1 = 5 ;
row_1 = "Min, Max" ;
output ;
section_order_1 = 2 ;
section_1 = "Month 1" ;
row_order_1 = 0 ;
row_1 = "Month 1" ;
output ;
section_order_1 = 2 ;
section_1 = "Month 1" ;
row_order_1 = 1 ;
row_1 = "n" ;
output ;
section_order_1 = 2 ;
section_1 = "Month 1" ;
row_order_1 = 2 ;
row_1 = "Mean (SD)" ;
output ;
section_order_1 = 2 ;
section_1 = "Month 1" ;
row_order_1 = 3 ;
row_1 = "Median" ;
output ;
section_order_1 = 2 ;
section_1 = "Month 1" ;
row_order_1 = 4 ;
row_1 = "Q1, Q3" ;
output ;
section_order_1 = 2 ;
section_1 = "Month 1" ;
row_order_1 = 5 ;
row_1 = "Min, Max" ;
output ;
run ;
to create a table:
using the following code:
ods listing close ;
ods rtf file = "test.rtf" ;
proc report data = test ;
column section_order_1
section_1
row_order_1
row_1
;
define section_order_1
/ order
noprint
;
define row_order_1
/ order
noprint
;
define section_1
/ display
;
define row_1
/ display
;
/******************/
compute before section_order_1 ;
line = " " ;
endcomp ;
compute row_1 ;
if row_order_1 > 0
then call define ( _col_
, "style"
, "style = { leftmargin = 3% }"
) ;
endcomp ;
run ;
ods rtf close ;
ods listing ;
I expect a blank line under the header and before Section_1 = "Month 1" and Row_1 = "Month 1". I am not consistently get a blank line before (between) sections. I included a second COMPUTE block that is creating a left margin for the "row" labels. Can anyone see an issue with the code or suggest some alternative?
Thank you,
Kevin
Cynthia,
I do not know how many times you have helped me, but if you see me at a conference, then let me know. I owe you a bottle, at least. (I think we met as SUGI 27 at the dinner [Saturday Night Massacre], but I may have you confused. Paul Kent and Sandra were also there.)
At any rate, that corrected the issue!
With much gratitude,
Kevin
PS Now to INFILE hundreds of programs to check 🙂
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.