data have;
term='all';
output;
term='par';
output;
term='';
a1='1';b1='2';c1='3';a2='4';b2='5';c2='6';
output;
run;
%let N=10;
%let year=20;
proc report data=have headline headskip nowd split='|' spacing=0;
column (term) ( "therapy" a1 b1 c1) ( "Compare" a2 b2 c2) ;
define term/display '|Term' left width=40 flow;
define a1/display ' n' center width=23;
define b1/display 'Number' center width=15;
define c1/display 'rate' center width=18;
define a2/display ' n' center width=20;
define b2/display 'Number' center width=15;
define c2/display 'rate' center width=18;
run;
Dear
in my report output i need to insert below text under both therapy and compare section when term='par'. thank you
N=&N.
Total years=&year.
I think you many need to create a table in a word processor and show what you want and share that.
" under both therapy and compare section" leads to questions such as "where under"? Part of the heading "Therapy" text displayed in the same cell? In a different cell under Therapy? Under each of the headings for A1 B1 and C1? Under some value of A1? Under B1? Under C1? At the bottom of the report.
And the bit that your two values for Term have nothing in the rest of the table raises why are they even in your code or example.
Thank you very much. I need to populate in the highlighted area in the attachemnt spanning all three columns. Thank you
Must it be in a separate cell? Or can it be in the same cell but a second line? This later is relatively easy and your code already included one of the options to do it. My example only shows for therapy the same use of | and other text with Compare would work. I show the N and Years on separate lines as it isn't exactly clear which is your intent because your
document only shows 2 dashes, not an example of the actual text you requested or where it goes.
proc report data=have headline headskip nowd split='|' spacing=0; column (term) ( "therapy|N=&n|Total years=&year" a1 b1 c1) ( "Compare" a2 b2 c2) ; define term/display '|Term' left width=40 flow; define a1/display ' n' center width=23; define b1/display 'Number' center width=15; define c1/display 'rate' center width=18; define a2/display ' n' center width=20; define b2/display 'Number' center width=15; define c2/display 'rate' center width=18; run;
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.