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

Hi 

 

I am trying to generate following output, I have tried various ways but no luck. Could you please help me out how to move the highlighted table to second page.

 

Getting:

csa_0-1602121667016.png

The highlighted in yellow color table should be moved to second page with separate title 'All'

 

This is my code.

 

proc template;
define style styles.tabstyle;
parent=styles.rtf;
style table from table /
cellpadding = 1pt;
style body from body /
leftmargin=1in
rightmargin=1in
topmargin=1.2in
bottommargin=1in;
style header from header /
frame=void
rules=groups
font_weight=medium
bordertopstyle=solid bordertopwidth=0.1px bordertopcolor=black
borderbottomstyle=solid borderbottomwidth=0.1px borderbottomcolor=black;
end;
run;

title;
footnote;
goptions reset=all;
options orientation=&lineop_ missing='';
ods noresults;
ods listing close;
ods rtf file="C:\Local\chk.rtf" notoc_data style=styles.tabstyle startpage=no ;
ods escapechar="^";

title1 j=left f=timesnewroman h=10pt "XYX";
title3 j=left "Grades and Sports";
proc print data=a width=full label split='~' style(table)=[vjust=middle just=center]
style(header)=[font_size=10pt font_weight=medium just=center]
style(column)=[font_size=10pt font_weight=medium just=left] noobs;

var Name Science Mathematics History Geography;
run;

title;
footnote;

proc print data=b width=full label split='~' style(table)=[vjust=middle just=center]
style(header)=[font_size=10pt font_weight=medium just=center]
style(column)=[font_size=10pt font_weight=medium just=left] noobs;

var Name Tennis Baseball Basketball Hockey Football;
run;


title3 j=left f=timesnewroman h=10pt "All";

proc print data = c width=full label split='~' style(table)=[vjust=middle just=center]
style(header)=[font_size=10pt font_weight=medium just=center]
style(column)=[font_size=10pt font_weight=medium just=left] noobs;

var Rank Name Tennis Baseball Basketball Hockey Science Mathematics History Geography;
run;

ods _all_ close;
ods listing;
ods noresults;

1 ACCEPTED SOLUTION

Accepted Solutions
mkeintz
PROC Star

Prior to the third proc print, issue an

ods startpage=now;

statement.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

View solution in original post

3 REPLIES 3
ballardw
Super User

Almost there. You can use ODS RTF, or other destinations,  without providing a file to modify ODS options like the startpage setting in the middle of the document.

 

ods rtf file="C:\Local\chk.rtf" notoc_data style=styles.tabstyle startpage=no ;
ods escapechar="^";

title1 j=left f=timesnewroman h=10pt "XYX";
title3 j=left "Grades and Sports";
proc print data=a width=full label split='~' style(table)=[vjust=middle just=center]
style(header)=[font_size=10pt font_weight=medium just=center]
style(column)=[font_size=10pt font_weight=medium just=left] noobs;

var Name Science Mathematics History Geography;
run;

title;
footnote;

proc print data=b width=full label split='~' style(table)=[vjust=middle just=center]
style(header)=[font_size=10pt font_weight=medium just=center]
style(column)=[font_size=10pt font_weight=medium just=left] noobs;

var Name Tennis Baseball Basketball Hockey Football;
run;

ods rtf startpage=NOW;
title3 j=left f=timesnewroman h=10pt "All";

proc print data = c width=full label split='~' style(table)=[vjust=middle just=center]
style(header)=[font_size=10pt font_weight=medium just=center]
style(column)=[font_size=10pt font_weight=medium just=left] noobs;

var Rank Name Tennis Baseball Basketball Hockey Science Mathematics History Geography;
run;

ods rtf close;
mkeintz
PROC Star

Prior to the third proc print, issue an

ods startpage=now;

statement.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 3 replies
  • 448 views
  • 2 likes
  • 3 in conversation