BookmarkSubscribeRSS Feed
mmkr
Quartz | Level 8

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;

 

mmkr_0-1717101386544.png

 

Iam looking only one table of contnets for both tables on left side ? is there any i can do and get the ouput ?

 

 

5 REPLIES 5
ballardw
Super User

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.

mmkr
Quartz | Level 8

I want to go in to next apge when ever new BY variable comes in 

Ksharp
Super User

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;

Ksharp_0-1717121731903.png

 

mmkr
Quartz | Level 8
Iam looking for two proc report in one pdf , each one having by variable same and proc contents should be sync

Proc report data=test1;by id;
columns col1 ocl2 col3;
run;

Proc report data=test2;by id;
columns col5 col6 col7;
run;

Ksharp
Super User

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;

Ksharp_0-1717225138194.png

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 5 replies
  • 482 views
  • 1 like
  • 3 in conversation