BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
KevinViel
Pyrite | Level 9

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:

report.jpg

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

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ
Hi:
The LINE statement does not have an = sign as part of the syntax. I don't think you'll get an error, but the LINE statement will NOT work with an = statement. When I use this technique, I always just have
line ' ';
inside the COMPUTE block.
Cynthia

View solution in original post

3 REPLIES 3
Cynthia_sas
SAS Super FREQ
Hi:
The LINE statement does not have an = sign as part of the syntax. I don't think you'll get an error, but the LINE statement will NOT work with an = statement. When I use this technique, I always just have
line ' ';
inside the COMPUTE block.
Cynthia
KevinViel
Pyrite | Level 9

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 🙂

Cynthia_sas
SAS Super FREQ
Kevin:
Happy to help! I think we've connected at a few other SUGI/SGFs as well.
Cynthia

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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