data test;
input id fname $4. lname $5. age;
cards;
123 abc1 def1 24
124 abc2 def2 25
125 abc3 def3 26
;
run;
data test2;
input id state $7. county $9. ;
cards;
123 state1 county1
124 state2 county2
125 state3 county3
;
run;
options orientation=landscape;
ods pdf file="location\name.pdf";
Title1 "Test";
ods proclabel='';
proc report data=test contents='' headline nowindows ;by id ;
columns id fname lname age;
run;
proc report data=test2 contents='' headline nowindows ;by id ;
columns id state county;
run;
ods pdf close;
Iam looking only one table of contnets for both tables on left side ? is there any i can do and get the ouput ?
I am not quite sure what you want.
If it is to have all of the report output on the same page then add STARTPAGE=NEVER to your ODS PDF statement. That will suppress any new pages.
IF you want to have two different reports interleaving output from the first report and the second alternating then you are moving into the macro language and much more complicated code.
I want to go in to next apge when ever new BY variable comes in
You want this ??
data test;
input id fname $4. lname $5. age;
cards;
123 abc1 def1 24
124 abc2 def2 25
125 abc3 def3 26
;
run;
data test2;
input id state $7. county $9. ;
cards;
123 state1 county1
124 state2 county2
125 state3 county3
;
run;
options orientation=landscape nobyline;
ods pdf file="c:\temp\name.pdf";
Title1 "Test1";
ods proclabel='Test1';
proc report data=test headline nowindows contents='';
columns id fname lname age;
define id/group;
break before id/page contents='';
run;
Title1 "Test2";
ods proclabel='Test2';
proc report data=test2 headline nowindows contents='' ;
columns id state county;
define id/group;
break before id/page contents='';
run;
ods pdf close;
You want this ?
data test;
input id fname $4. lname $5. age;
cards;
123 abc1 def1 24
124 abc2 def2 25
125 abc3 def3 26
;
run;
data test2;
input id state $7. county $9. ;
cards;
123 state1 county1
124 state2 county2
125 state3 county3
;
run;
options orientation=landscape;
ods document name=testAW(write);
proc report data=test contents='' headline nowindows ;by id ;
columns id fname lname age;
define id/group;
break before id / contents="" page;
run;
proc report data=test2 contents='' headline nowindows ;by id ;
columns id state county;
define id/group;
break before id / contents="" page;
run;
ods document close;
proc document name=testAW;
list/ levels=all; run;
quit;
proc document name=testAW2(write);
make \CLASS#1;
setlabel \Class#1 "table set 1";
copy \work.testAW\Report#1\ByGroup1#1\Report#1 to \Class#1;
copy \work.testAW\Report#1\ByGroup2#1\Report#1 to \Class#1;
copy \work.testAW\Report#1\ByGroup3#1\Report#1 to \Class#1;
run;
make \CLASS2#1;
setlabel \Class2#1 "table set 2";
copy \work.testAW\Report#2\ByGroup1#1\Report#1 to \Class2#1;
copy \work.testAW\Report#2\ByGroup2#1\Report#1 to \Class2#1;
copy \work.testAW\Report#2\ByGroup3#1\Report#1 to \Class2#1;
run;
list/ levels=all; run;
quit;
title;
proc document name=work.testAW2;
ods pdf file="c:\temp\name.pdf" startpage=no ;
obtitle \CLASS#1\Report#1 'table set 1';
replay \CLASS#1;
run;
ods pdf startpage=now;
obtitle \CLASS2#1\Report#1 'table set 2';
replay \CLASS2#1;
run;
ods pdf close;
quit;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
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.