BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Arora_S
Obsidian | Level 7

Is it possible to have a summary and detailed report on 1 page. For an example below my data looks like this :(input sasfile also attached

 

cust_name sex OI_Date client_name client_num Asso_code count Misc_Count
john  Male 8/19/2016 john 1 100 1 5
john  Male 8/19/2016 wilson 2 100 1 6
john  Male 8/19/2016 mary 3 200 3 3
john  Male 8/19/2016 nirvana 4 300 5 7
john  Male 8/19/2016 gatsy 5 400 1 8
john  Male 8/19/2016 cassy 6 500 6 8
john  Male 8/19/2016 cassida 7 600 7 7
john  Male 8/19/2016 tim 8 700 3 8
john  Male 8/19/2016 rob 9 800 1 3

 

Result needed on 1 page as below so it has summary and detailed report both on 1 page by the cust_name values as page grouping variable:

      Title1 "Summary"          
                     
ByVal(group Var):John   Count for Asso_code          
  100 200 300 400 500 600 700 800 Total_Count Misc_count_total
  2 3 5 1 6 7 3 1 27 55

 

  Title 2 "Detailed"
sex Client_Name client_num
M john   1
  wilson   2
  mary   3
  nirvana 4
  gatsy   5
  cassy   6
  cassida   7
  tim   8
  rob   9

 

Used 2 separate report codes which give output on different pages using ods instead of both detailed and summary on 1 page :

 (Note : misc_count_total not included)

ODS _all_ CLOSE;
ods results;
OPTIONS orientation=portrait   NONUMBER NODATE LS=248 PS =256 COMPRESS=NO   MISSING = ''
topmargin=.25in bottommargin=.25in leftmargin=.50in rightmargin=.50in  nobyline  papersize=a4;
ods escapechar='^';
Footnote;

TITLE1 bold f= Calibri h=14pt j=c "Summary"             ;
TITLE2    f= Calibri j=l h=9pt    "#byval(cust_name)";
proc report nofs  data = data nowd spanrows split='~' headline missing
by cust_name ; /*so eeach page has a different customer and their summary and detailed report as well in order*/
column ('Cust_Name' Cust Name) asso_code,count     ;
define  Cust_Name /group   left style(column)= { cellwidth=45mm  rules=none just=left
style(header)={just=left cellwidth=45mm rules=none};
define asso_code    / across 'Count for Asso_code' center format=$combdx. preloadfmt  style(column)={just=center cellwidth=10mm rules=none vjust = middle }
style(header)={just=center cellwidth=10mm rules=none vjust = middle};
define  count    / sum ' ' center style(column)={just=center cellwidth=10mm rules=none }
style(header)={just=center cellwidth=10mm rules=none};
   compute after Count for Asso_code;
line '--------------------------------------------------------------------------------------------------------------------------------------------------' ;
  endcomp ;
break after  Count for Asso_code/ skip dol dul;
run;

 

TITLE1 bold f= Calibri h=14pt j=c "Detailed"             ;

TITLE2    f= Calibri j=l h=9pt    "#byval(cust_name)";

proc report nofs  data = data nowd spanrows   split='~' headline missing
;
by cust_name  ;
column sex  client_name client_num
 ;
define  cust_name/group page noprint ''  left style = {cellwidth=70mm  rules=none };
define  client_name/ordercenter   style(column)={just=center cellwidth=60mm rules=none }
style(header)={just=center cellwidth=60mm rules=none};
define  count    / group 'client_num' center style(column)={just=center cellwidth=60mm rules=none }
style(header)={just=center cellwidth=60mm rules=none};
 break after cust_name/ page  ;
compute before _page_ / style = {just = c NOBREAKSPACE=on asis=on};
endcomp;
break after  cust_name/ skip dul;
run;

ods pdf close;

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

There's  no ODS PDF there that I see. 

Did you try the STARTPAGE option for the ODS statement? 

View solution in original post

5 REPLIES 5
Reeza
Super User

Yes, as long as there's actually physically space on a page. Although you've included your PROC REPORT code you don't actually mention your ODS destination? Is it Word? Excel? PDF? For Word and PDF look at the STARTPAGE option and set it to NO or NEVER.

This means that all PROCs output to a page until it runs out of space, otherwise it starts a new page. 

The default behaviour is each PROC goes to a new page. 

Arora_S
Obsidian | Level 7

Their is space on page of A4 size, even if space is fiiled up ..i want remaining inofrmation for that grouping variable to go on the following page which is Ok.

I have updated my code with ODS statement which was missing before for reference. The output is in pdf to confirm.

 

Reeza
Super User

There's  no ODS PDF there that I see. 

Did you try the STARTPAGE option for the ODS statement? 

Arora_S
Obsidian | Level 7

startpage option with yes fixed the issue.....

thanks for good solution

Arora_S
Obsidian | Level 7

Merry Christmas to Everyone !

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
  • 5 replies
  • 1119 views
  • 0 likes
  • 2 in conversation