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;

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