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;
Maybe try ods text instead?
Thank you @Miracle 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 ...
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;
This is mostly off-topic, but how would I know what my company logo color is in CX notation?
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.
@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
mm is the magenta component.
yy is the yellow component.
kk is the black component.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.