Data visualization with SAS programming

ODS PDF -- 2 charts per page, titles missing on 2nd chart

Accepted Solution Solved
Reply
Respected Advisor
Posts: 2,153
Accepted Solution

ODS PDF -- 2 charts per page, titles missing on 2nd chart

[ Edited ]

Let's suppose I want to put two tables on one page using ODS PDF. Each table is to have a different title. If I use this code, the second table's title doesn't appear (as shown in the attachment). What am I doing wrong?

 

ods pdf file="&cdu\temp.pdf" startpage=no;
title "SASHELP.CARS";
title2 "First 10 Rows";
proc print data=sashelp.cars(obs=10);
	id make model;
	var msrp mpg_highway;
run;
title "SASHELP.CARS";
title2 "Second 10 Rows";
proc print data=sashelp.cars(firstobs=11 obs=20);
	id make model;
	var msrp mpg_highway;
run;
ods pdf close;

 

--
Paige Miller

Accepted Solutions
Solution
‎09-07-2017 03:26 PM
Regular Contributor
Posts: 236

Re: ODS PDF -- 2 charts per page, titles missing on 2nd chart

[ Edited ]
Posted in reply to PaigeMiller

All Replies
Solution
‎09-07-2017 03:26 PM
Regular Contributor
Posts: 236

Re: ODS PDF -- 2 charts per page, titles missing on 2nd chart

[ Edited ]
Posted in reply to PaigeMiller
Super User
Posts: 21,464

Re: ODS PDF -- 2 charts per page, titles missing on 2nd chart

Posted in reply to PaigeMiller
Issue replicated on SAS 9.4 TS1M3.

ODS TEXT does function as a workaround but you'd have to customize the format/style which is annoying.
Respected Advisor
Posts: 2,153

Re: ODS PDF -- 2 charts per page, titles missing on 2nd chart

[ Edited ]

Thank you @wong and @Reeza.

 

This now works

 

ods escapechar='^';
ods pdf file="&cdu\temp.pdf" startpage=no; ods pdf text = "^{style [just=center font=(Arial) fontsize=11pt fontweight=bold color=verydarkstrongblue] SASHELP.CARS}"; ods pdf text = "^{style [just=center font=(Arial) fontsize=11pt fontweight=bold color=verydarkstrongblue] First 10 Rows}"; proc print data=sashelp.cars(obs=10); id make model; var msrp mpg_highway; run; ods pdf text = "^{newline 2}"; ods pdf text = "^{style [just=center font=(Arial) fontsize=11pt fontweight=bold color=verydarkstrongblue] SASHELP.CARS}"; ods pdf text = "^{style [just=center font=(Arial) fontsize=11pt fontweight=bold color=verydarkstrongblue] 2nd 10 Rows}"; proc print data=sashelp.cars(firstobs=11 obs=20); id make model; var msrp mpg_highway; run; ods pdf close;

Okay, I went a little crazy with the style options, but when you have a new toy, you play with it ...

 

--
Paige Miller
Super User
Posts: 21,464

Re: ODS PDF -- 2 charts per page, titles missing on 2nd chart

Posted in reply to PaigeMiller

Don't know if this is useful, but recently realized you can specify colours in SAS using 

 

CX[HEXCOLOUR] which works great when trying to match company styles:

 

ods pdf text = "^{style [just=center font=(Arial) fontsize=11pt fontweight=bold color=Cx00aad2] First 10 Rows}";
%let cdu = C:\_localdata\temp;

ods escapechar='^';
ods pdf file="&cdu\temp.pdf" startpage=no;
ods pdf text = "^{style [just=center font=(Arial) fontsize=11pt fontweight=bold color=cxff7900] SASHELP.CARS}";
ods pdf text = "^{style [just=center font=(Arial) fontsize=11pt fontweight=bold color=cxd40072] First 10 Rows}";
proc print data=sashelp.cars(obs=10);
	id make model;
	var msrp mpg_highway;
run;
ods pdf text = "^{newline 2}";
ods pdf text = "^{style [just=center font=(Arial) fontsize=11pt fontweight=bold color=Cx00aad2] SASHELP.CARS}";
ods pdf text = "^{style [just=center font=(Arial) fontsize=11pt fontweight=bold color=Cx00aad2] 2nd 10 Rows}";
proc print data=sashelp.cars(firstobs=11 obs=20);
	id make model;
	var msrp mpg_highway;
run;
ods pdf close;
Respected Advisor
Posts: 2,153

Re: ODS PDF -- 2 charts per page, titles missing on 2nd chart

This is mostly off-topic, but how would I know what my company logo color is in CX notation?

--
Paige Miller
Super User
Posts: 21,464

Re: ODS PDF -- 2 charts per page, titles missing on 2nd chart

Posted in reply to PaigeMiller

My company has a corporate style guide courtesy of communications.

 

Another way is to go the to company website, use the web developer tools, check the CSS (cascading style sheet) for the colours used for common things, ie text, possibly logo, specific headings etc. 

Super User
Posts: 12,148

Re: ODS PDF -- 2 charts per page, titles missing on 2nd chart

Posted in reply to PaigeMiller

PaigeMiller wrote:

This is mostly off-topic, but how would I know what my company logo color is in CX notation?


It may be easier to use CMYK if your organization has a Pantone Color look up somewhere for a printing documents.

The SAS color code would look like: CMYKccmmyykk where

cc is the cyan component.

mm is the magenta component.

yy is the yellow component.

kk is the black component.

 

 
The components are hexadecimal numbers in the range 00–FF, where higher values are darker and lower values are brighter. This scheme allows for up to 256 levels of each color component.
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 285 views
  • 8 likes
  • 4 in conversation