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;
There's no ODS PDF there that I see.
Did you try the STARTPAGE option for the ODS statement?
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.
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.
There's no ODS PDF there that I see.
Did you try the STARTPAGE option for the ODS statement?
startpage option with yes fixed the issue.....
thanks for good solution
Merry Christmas to Everyone !
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.