BookmarkSubscribeRSS Feed
raja777pharma
Fluorite | Level 6

Hello Team,

 

I am struggling to generate RTF as per below screen shot, My out put is not coming as Group for COL1,COL2, and need to put blank line between (Break) COl1 after value 'Observed ' and 'Changed'

 

Note : The data should be in sort order of vars - gpxpage paramn avisitn catno

In Below screen shot have more columns , but in my out put column are restricted and will come next RTF page

 

I have attached the data set and same data set in excel sheet.

 

I need output like below :

 

raja777pharma_0-1585823218609.png

My Current code :

ods escapechar = '^';

proc Report data=report split='^' missing nowd spanrows headline headskip ;
	column gpxpage paramn avisitn catno col1 col2 col3 col4 col5 col6 col7  ;
	define gpxpage	/order order=internal "" noprint;
	define paramn	/order order=internal "" noprint;
	define avisitn /order order=internal "" noprint;
    define catno /order order=internal "" noprint;

	define col1 /&Header  group style(column)=[cellwidth=1.2in font_face=Courier font_size=1.25just=l asis=on] style(hdr)=[just=l asis=on] flow;
    define col2 /"Parameter"  group style(column)=[cellwidth=0.8in font_face=Courier font_size=1.25just=l asis=on] style(hdr)=[just=l asis=on] flow;
    define col3 /"Statistics"   style(column)=[cellwidth=0.9in font_face=Courier font_size=1.25just=l asis=on] style(hdr)=[just=l asis=on] flow;
	define col4 /&Header1.   style(column)=[cellwidth=1in	font_face=Courier font_size=1.25just=c asis=on] style(hdr)=[just=c asis=on];
	define col5 /&Header2.  style(column)=[cellwidth=1in font_face=Courier font_size=1.25just=c asis=on] style(hdr)=[just=c asis=on];
    define col6 /&Header3.  style(column)=[cellwidth=1in font_face=Courier font_size=1.25just=c asis=on] style(hdr)=[just=c asis=on];
    define col7 /&Header99.  style(column)=[cellwidth=1in font_face=Courier font_size=1.25just=c asis=on] style(hdr)=[just=c asis=on];

	break after gpxpage / page;

	compute before gpxpage;
        line " ";
    endcomp;

run;

My Current output :

 

raja777pharma_1-1585823347108.png

 

Attached data set and same data in excel sheet

4 REPLIES 4
Oligolas
Barite | Level 11

Hi, 

 

I do not exactly know how your variables are populated so please allow me just to post an example on how to do it:

ods listing;
Data have;
length gpxpage paramn avisitn 8 col1 col2 col3 $15;
   gpxpage=1;paramn=1;avisitn=0;col1='Baseline';col2='Observed';col3='n';output;
   gpxpage=1;paramn=1;avisitn=0;col1='Baseline';col2='Observed';col3='Mean (SD)';output;
   gpxpage=1;paramn=1;avisitn=0;col1='Baseline';col2='Observed';col3='Median';output;
   gpxpage=1;paramn=1;avisitn=0;col1='Baseline';col2='Observed';col3='Min, Max';output;
   gpxpage=1;paramn=2;avisitn=1;col1='C1D1';col2='Observed';col3='n';output;
   gpxpage=1;paramn=2;avisitn=1;col1='C1D1';col2='Observed';col3='Mean (SD)';output;
   gpxpage=1;paramn=2;avisitn=1;col1='C1D1';col2='Observed';col3='Median';output;
   gpxpage=1;paramn=2;avisitn=1;col1='C1D1';col2='Observed';col3='Min, Max';output;
   gpxpage=1;paramn=2;avisitn=99;col1='C1D1';col2='Change [1]';col3='n';output;
   gpxpage=1;paramn=2;avisitn=99;col1='C1D1';col2='Change [1]';col3='Mean (SD)';output;
   gpxpage=1;paramn=2;avisitn=99;col1='C1D1';col2='Change [1]';col3='Median';output;
   gpxpage=1;paramn=2;avisitn=99;col1='C1D1';col2='Change [1]';col3='Min, Max';output;
   gpxpage=1;paramn=3;avisitn=8;col1='C1D8';col2='Observed';col3='n';output;
   gpxpage=1;paramn=3;avisitn=8;col1='C1D8';col2='Observed';col3='Mean (SD)';output;
   gpxpage=1;paramn=3;avisitn=8;col1='C1D8';col2='Observed';col3='Median';output;
   gpxpage=1;paramn=3;avisitn=8;col1='C1D8';col2='Observed';col3='Min, Max';output;
   gpxpage=1;paramn=4;avisitn=99;col1='C1D8';col2='Change [1]';col3='n';output;
   gpxpage=1;paramn=4;avisitn=99;col1='C1D8';col2='Change [1]';col3='Mean (SD)';output;
   gpxpage=1;paramn=4;avisitn=99;col1='C1D8';col2='Change [1]';col3='Median';output;
   gpxpage=1;paramn=4;avisitn=99;col1='C1D8';col2='Change [1]';col3='Min, Max';output;
run;

proc Report data=have split='^' missing nowd spanrows headline headskip ;
   column gpxpage paramn avisitn  col1 col2 col3 ;
   define gpxpage	/order order=internal "" noprint;
   define paramn	/order order=internal "" noprint;
   define avisitn /order order=internal "" noprint;

   define col1 /  order style(column)=[cellwidth=1.2in font_face=Courier font_size=1.25just=l asis=on] style(hdr)=[just=l asis=on] flow;
   define col2 /  order style(column)=[cellwidth=0.8in font_face=Courier font_size=1.25just=l asis=on] style(hdr)=[just=l asis=on] flow;
   define col3 /        style(column)=[cellwidth=0.9in font_face=Courier font_size=1.25just=l asis=on] style(hdr)=[just=l asis=on] flow;

   break after gpxpage / page;

   compute before avisitn;
        line " ";
   endcomp;
run;

Oligolas_0-1585835636507.png

 

________________________

- Cheers -

raja777pharma
Fluorite | Level 6
Hello Cheers,
Thank your for replay ,

can we display COL1 as group where in COL1 it's showing two 'C1D1' , so we can display only one 'C1D1'

Thank you.
sahoositaram555
Pyrite | Level 9
Hi @raja777pharma,
Please add "group " after / at the statement define col1 / order style(column)=[cellwidth=1.2in font_face=Courier font_size=1.25just=l asis=on] style(hdr)=[just=l asis=on] flow;
Oligolas
Barite | Level 11

oh yes I see. It will be best to have a numeric data structure for clean sorting

ods listing;

proc format;
value visits
   1='Baseline'
   2='C1D1'
   3='C1D8'
   ;
value obs
   1='Observed'
   2='Change [1]'
   ;
value stats
   1='n'
   2='Mean (SD)'
   3='Median'
   4='Min, Max'
   ;
run;


Data have;
length gpxpage paramn avisitn col1 col2 col3 8;
 gpxpage=1;paramn=1;avisitn=0; col1=1; col2=1; col3=1;output;
 gpxpage=1;paramn=1;avisitn=0; col1=1; col2=1; col3=2;output;
 gpxpage=1;paramn=1;avisitn=0; col1=1; col2=1; col3=3;output;
 gpxpage=1;paramn=1;avisitn=0; col1=1; col2=1; col3=4;output;
 gpxpage=1;paramn=2;avisitn=1; col1=2; col2=1; col3=1;output;
 gpxpage=1;paramn=2;avisitn=1; col1=2; col2=1; col3=2;output;
 gpxpage=1;paramn=2;avisitn=1; col1=2; col2=1; col3=3;output;
 gpxpage=1;paramn=2;avisitn=1; col1=2; col2=1; col3=4;output;
 gpxpage=1;paramn=2;avisitn=99; col1=2; col2=2; col3=1;output;
 gpxpage=1;paramn=2;avisitn=99; col1=2; col2=2; col3=2;output;
 gpxpage=1;paramn=2;avisitn=99; col1=2; col2=2; col3=3;output;
 gpxpage=1;paramn=2;avisitn=99; col1=2; col2=2; col3=4;output;
 gpxpage=1;paramn=3;avisitn=8; col1=3; col2=1; col3=1;output;
 gpxpage=1;paramn=3;avisitn=8; col1=3; col2=1; col3=2;output;
 gpxpage=1;paramn=3;avisitn=8; col1=3; col2=1; col3=3;output;
 gpxpage=1;paramn=3;avisitn=8; col1=3; col2=1; col3=4;output;
 gpxpage=1;paramn=4;avisitn=99; col1=3; col2=2; col3=1;output;
 gpxpage=1;paramn=4;avisitn=99; col1=3; col2=2; col3=2;output;
 gpxpage=1;paramn=4;avisitn=99; col1=3; col2=2; col3=3;output;
 gpxpage=1;paramn=4;avisitn=99; col1=3; col2=2; col3=4;output;
 format col1 visits. col2 obs. col3 stats.;
run;


proc Report data=have split='^' missing nowd spanrows headline headskip ;
   column gpxpage paramn col1 avisitn col2 col3;
   define gpxpage	/order order=internal "" noprint;
   define paramn	/order order=internal "" noprint;
   define avisitn /order order=internal "" noprint;

   define col1 /  order format=visits. order=internal style(column)=[cellwidth=1.2in font_face=Courier font_size=1.25just=l asis=on] style(hdr)=[just=l asis=on] flow;  
   define col2 /  order format=obs.    order=internal style(column)=[cellwidth=0.8in font_face=Courier font_size=1.25just=l asis=on] style(hdr)=[just=l asis=on] flow;
   define col3 /  order format=stats.  order=internal style(column)=[cellwidth=0.9in font_face=Courier font_size=1.25just=l asis=on] style(hdr)=[just=l asis=on] flow;

   break after gpxpage / page;

   compute before avisitn;
        line " ";
   endcomp;
run;

 

 

 

________________________

- Cheers -

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