BookmarkSubscribeRSS Feed
vikram_e
Fluorite | Level 6

Hi There

 

i am facing issue in the report in rtf file, i need to generate rtf file with 6 column (Col1.....col6);

col1 values should split into 2 lines and reset of the col2-col6 values need to alien from  2nd line, can any one help me on this.

 

col1 is a order variable.             

 

My RTF report need to look like this.

 

col1               col2      col3    col4   col5   col6

xyz...(line1)         ****need space ******

.......(line2)    xxx       xxx      xxx     xxx     xxx

abc               xxx       xxx      xxx     xxx     xxx

 

Thanks 

2 REPLIES 2
PaigeMiller
Diamond | Level 26

@vikram_e wrote:

Hi There

 

i am facing issue in the report in rtf file, i need to generate rtf file with 6 column (Col1.....col6);

col1 values should split into 2 lines and reset of the col2-col6 values need to alien from  2nd line, can any one help me on this.

 

col1 is a order variable.             

 

My RTF report need to look like this.

 

col1               col2      col3    col4   col5   col6

xyz...(line1)         ****need space ******

.......(line2)    xxx       xxx      xxx     xxx     xxx

abc               xxx       xxx      xxx     xxx     xxx

 

Thanks 


Of course, it would be very helpful to see some sample data.

It would also be very helpful if you could explain

 

xyz...(line1)

.........(line2)

 

as this means nothing to me. 

 

My general approach to this is to use PROC SUMMARY to obtain the proper statistics and a data step (if necessary) to create the proper rows (with a blank row that you obviously want), and then you can use PROC REPORT or even PROC PRINT to get the output to appear the way you want.

--
Paige Miller
BrunoMueller
SAS Super FREQ

If you need to wrap some data content, you can use inline formatting, see ODS ESCAPECHAR= for more information.

 

Here is an example using this technique, the "<br>" is replace with the inline formatting function for a newline. Please make sure the variable used is wide enough to accommodate the inline formatting functions. 

 

data have;
  infile cards dlm=",";
  input
    col1 : $64.
    col2
    col3
    col4
    col5
    col6
  ;
  col1N = tranwrd(col1, "<br>", "^{newline}");
cards;
xyz(line1)<br>(line2),1,2,3,4,5
xyzabc,10,20,30,40,50
;

ods escapechar="^";
proc report data=have;
  column col1n col2-col6;
  define col2 - col6 / style={ just=r vjust=bottom};
run;

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
  • 1150 views
  • 0 likes
  • 3 in conversation