BookmarkSubscribeRSS Feed
jacupp711
Calcite | Level 5

Hello! I am putting together a PDF report that consists of 4 tables. Each table needs its own page with a title at the top of the table. I am able to break the tables up onto 4 pages but how would I get the titles to display above the individual tables? It's not a header that's the same on each they all have separate titles. Below is my code for two of the tables.

 

options
nonumber
orientation = landscape
papersize=letter
NODATE
leftmargin=.04in
rightmargin=.04in
topmargin=0in
bottommargin=0in
label
nobyline
missing=''
;

ODS PDF FILE= '/prd/saucra/adhoc/jupp/HTP/report.pdf' NOGFOOTNOTE NOTOC STARTPAGE=yes;

ODS escapechar='^';


ods pdf text= "^S={ font=(Arial, 12pt, bold) color=CX003366 just = left} NOV HTP Performance Report - &fk_StartDate.";
ods pdf text='^S={ font=(Arial, 8pt, bold) just=left font_weight=bold color = CXC01933} ____________________________________________________________________________________________________________________________________________________________________________________';

/*Proc report output - Table 1*/
PROC REPORT DATA = _001_raw_mstr1_cmbd1_SAS1_1 nowindows split='~' spanrows
style(header) = [background=CX003366 foreground=white font=('Arial', 8pt) font_weight=bold]
style(column) = [font = ('Arial', 8pt)]
style (report) = {width = 100% cellspacing=.15pt cellpadding=2pt}
;
COLUMN FK_type KPI ref_point FK_Type_in_LOF_0 FK_Type_in_LOF_1 FK_Type_in_LOF_2 FK_Type_in_LOF_3 FK_Type_in_LOF_4 FK_Type_in_LOF_5 FK_Type_in_LOF_6 FK_Type_in_LOF_7 FK_Type_in_LOF_8;
title = "^S={ font=(Arial, 10pt, bold) color=CX003366 just = center} Total Full Kits (Excluding Origination Kits)";
DEFINE FK_type/'FK Type' display center group order=data style(column)=[vjust=middle just=left];
DEFINE KPI/'KPI' display center group order=data style(column)=[vjust=middle just=left];
DEFINE ref_point/'Ref Point' display center group order=data;
DEFINE FK_Type_in_LOF_0 /'0' display center f=numeric9.2;
DEFINE FK_Type_in_LOF_1/'1' display center f=numeric9.2;
DEFINE FK_Type_in_LOF_2/'2' display center f=numeric9.2;
DEFINE FK_Type_in_LOF_3/'3' display center f=numeric9.2;
DEFINE FK_Type_in_LOF_4/'4' display center f=numeric9.2;
DEFINE FK_Type_in_LOF_5/'5' display center f=numeric9.2;
DEFINE FK_Type_in_LOF_6/'6' display center f=numeric9.2;
DEFINE FK_Type_in_LOF_7/'7' display center f=numeric9.2;
DEFINE FK_Type_in_LOF_8/'8' display center f=numeric9.2;


/*Proc report output - Table 2*/
PROC REPORT DATA = _001_raw_mstr1_cmbd1_SAS1_1 nowindows split='~' spanrows
style(header) = [background=CX003366 foreground=white font=('Arial', 8pt) font_weight=bold]
style(column) = [font = ('Arial', 8pt)]
style (report) = {width = 100% cellspacing=.15pt cellpadding=2pt}
;
COLUMN FK_type KPI ref_point FK_Type_in_LOF_0 FK_Type_in_LOF_1 FK_Type_in_LOF_2 FK_Type_in_LOF_3 FK_Type_in_LOF_4 FK_Type_in_LOF_5 FK_Type_in_LOF_6 FK_Type_in_LOF_7 FK_Type_in_LOF_8;
title = "^S={ font=(Arial, 10pt, bold) color=CX003366 just = center} Consecutive Full Kits (Excluding Origination Kits)";
DEFINE FK_type/'FK Type' display center group order=data style(column)=[vjust=middle just=left];
DEFINE KPI/'KPI' display center group order=data style(column)=[vjust=middle just=left];
DEFINE ref_point/'Ref Point' display center group order=data;
DEFINE FK_Type_in_LOF_0 /'0' display center f=numeric9.2;
DEFINE FK_Type_in_LOF_1/'1' display center f=numeric9.2;
DEFINE FK_Type_in_LOF_2/'2' display center f=numeric9.2;
DEFINE FK_Type_in_LOF_3/'3' display center f=numeric9.2;
DEFINE FK_Type_in_LOF_4/'4' display center f=numeric9.2;
DEFINE FK_Type_in_LOF_5/'5' display center f=numeric9.2;
DEFINE FK_Type_in_LOF_6/'6' display center f=numeric9.2;
DEFINE FK_Type_in_LOF_7/'7' display center f=numeric9.2;
DEFINE FK_Type_in_LOF_8/'8' display center f=numeric9.2;

 

I read that startpage = yes may be the reason the titles are left behind but when I take that away how could I still force each table onto a new page with a title above it? Thank you! I'm new to making pdfs with sas and appreciate the help!

3 REPLIES 3
ballardw
Super User

Use an ODS PDF STARTPAGE=NOW; before each proc report to force the where the page breaks

Place the title for the table after the ODS PDF statement and before the Proc Report if you mean actual SAS titles.

 

You don't show any Title statement so if you mean the ODS Text is your title that would go after the ODS PDF statement and before the proc report.

jacupp711
Calcite | Level 5

I'm using 

 

ods pdf startpage= now;
ods pdf;
ods proclabel = 'first';
title1 "^S={ font=(Arial, 12pt, bold) color=CX003366 just = left} NOV HTP Performance Report - &fk_StartDate.";
title2 "^S={ font=(Arial, 10pt, bold) color=CX003366 just = center} Total Full Kits (Excluding Origination Kits)";
PROC REPORT DATA = _001_raw_mstr1_cmbd1_SAS1_1 nowindows split='~' spanrows:

 

and the tables are breaking correctly with titles above each table. However, the titles are not corresponding to the correct table. It looks like the title that was supposed to be with the first page was dropped, the second title was with the first table, third title with the second table and so on.

 

Any idea why the first title is being dropped and why they aren't pairing up correctly?

Thanks

 

ballardw
Super User

@jacupp711 wrote:

I'm using 

 

ods pdf startpage= now;
ods pdf; <=== Why is this here?
ods proclabel = 'first';
title1 "^S={ font=(Arial, 12pt, bold) color=CX003366 just = left} NOV HTP Performance Report - &fk_StartDate.";
title2 "^S={ font=(Arial, 10pt, bold) color=CX003366 just = center} Total Full Kits (Excluding Origination Kits)";
PROC REPORT DATA = _001_raw_mstr1_cmbd1_SAS1_1 nowindows split='~' spanrows:

 

and the tables are breaking correctly with titles above each table. However, the titles are not corresponding to the correct table. It looks like the title that was supposed to be with the first page was dropped, the second title was with the first table, third title with the second table and so on.

 

Any idea why the first title is being dropped and why they aren't pairing up correctly?

Thanks

 


Likely cause is the simple ODS PDF. That would be used to reset options.

Please see: Replace <yourpath> with a valid path.

ods pdf file='<yourpath>\test.pdf' startpage=now;;
ods proclabel='First';
title 'First Title';
proc print data=sashelp.class (obs=3);
run;

ods pdf startpage=now;
ods proclabel='Second';
title 'Second Title';
proc print data=sashelp.class (firstobs=4 obs=6);
run;

ods pdf startpage=now;
ods proclabel='Third';
title 'Third Title';
proc print data=sashelp.class (firstobs=7 obs=9);
run;

ods pdf close;

It really helps to provide an example data set or use a SAS supplied data set.

Also do not provide code with macro variables without assignment code to provide values for the macro variable. A very great deal can be obscured in macro variables.

 

For a question about placing Titles it would be better to provide very simple title statements and simple output as I did so we don't have to dig through irrelevant code.

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
  • 1485 views
  • 0 likes
  • 2 in conversation